sfx2/inc/sfx2/doctempl.hxx                |   15 +++
 sfx2/inc/sfx2/templatelocalview.hxx       |    2 
 sfx2/inc/sfx2/templateview.hxx            |    3 
 sfx2/inc/sfx2/templateviewitem.hxx        |    4 
 sfx2/inc/sfx2/thumbnailview.hxx           |    2 
 sfx2/inc/sfx2/thumbnailviewitem.hxx       |    9 ++
 sfx2/source/control/templatelocalview.cxx |   21 ++++
 sfx2/source/control/templateview.cxx      |   10 ++
 sfx2/source/control/templateviewitem.cxx  |    4 
 sfx2/source/control/thumbnailview.cxx     |    9 ++
 sfx2/source/control/thumbnailviewitem.cxx |  128 +++++++++++++++++++++++++++++-
 sfx2/source/doc/doctempl.cxx              |   55 ++++++++++++
 sfx2/source/doc/doctemplates.cxx          |   15 +++
 13 files changed, 270 insertions(+), 7 deletions(-)

New commits:
commit d4617cf434844f15c7be29ecc95edf0b4e384e67
Author: Cédric Bosdonnat <[email protected]>
Date:   Mon Feb 11 15:30:16 2013 +0100

    Templates Manager: UI for renaming templates and folders, fdo#60579
    
    After thinking this was a feature regression, I finally discovered that
    the old template manager couldn't rename templates. This commit is
    bringing back some previously unused code dropped in an ealier commit.
    
    Even though this is a UI change, no new string is added by this commit.

diff --git a/sfx2/inc/sfx2/doctempl.hxx b/sfx2/inc/sfx2/doctempl.hxx
index 01d398f..54e53c6 100644
--- a/sfx2/inc/sfx2/doctempl.hxx
+++ b/sfx2/inc/sfx2/doctempl.hxx
@@ -92,6 +92,21 @@ public:
     sal_Bool            Delete(sal_uInt16 nRegion, sal_uInt16 nIdx);
     sal_Bool            InsertDir(const String &rText, sal_uInt16 nRegion);
 
+    /** Change the name of an entry or a directory
+        
+        \param rName
+            The new name to set
+        \param nRegion
+            The id of the region to rename or containing the template to rename
+        \param nIdx
+            The id of the template to rename or USHRT_MAX to rename the region.
+
+        \return
+            sal_True if the action could be performed, sal_False otherwise
+
+    */
+    sal_Bool            SetName(const rtl::OUString &rName, sal_uInt16 
nRegion, sal_uInt16 nIdx);
+
     sal_Bool            CopyTo(sal_uInt16 nRegion, sal_uInt16 nIdx, const 
String &rName) const;
     sal_Bool            CopyFrom(sal_uInt16 nRegion, sal_uInt16 nIdx, String 
&rName);
 
diff --git a/sfx2/inc/sfx2/templatelocalview.hxx 
b/sfx2/inc/sfx2/templatelocalview.hxx
index 5c54375..c27659f 100644
--- a/sfx2/inc/sfx2/templatelocalview.hxx
+++ b/sfx2/inc/sfx2/templatelocalview.hxx
@@ -68,6 +68,8 @@ public:
                          const OUString &rName);
 
     bool isTemplateNameUnique (const sal_uInt16 nRegionItemId, const OUString 
&rName) const;
+    
+    virtual void renameItem(ThumbnailViewItem* pItem, rtl::OUString sNewTitle);
 
 private:
 
diff --git a/sfx2/inc/sfx2/templateview.hxx b/sfx2/inc/sfx2/templateview.hxx
index 8ee529d..81582ef 100644
--- a/sfx2/inc/sfx2/templateview.hxx
+++ b/sfx2/inc/sfx2/templateview.hxx
@@ -42,6 +42,8 @@ public:
     // FIXME Kept only during the refactoring
     void setOpenHdl (const Link &rLink) { maOpenHdl = rLink; }
     virtual void OnItemDblClicked(ThumbnailViewItem *pItem) { 
maOpenHdl.Call(pItem); }
+    void setMasterView(TemplateAbstractView* pMasterView) { mpMasterView = 
pMasterView; }
+    virtual void renameItem(ThumbnailViewItem* pItem, rtl::OUString sNewTitle);
 
 protected:
 
@@ -50,6 +52,7 @@ protected:
 private:
 
     Link maOpenHdl;
+    TemplateAbstractView* mpMasterView;
 
     Control    maButtons;
     PushButton maAllButton;
diff --git a/sfx2/inc/sfx2/templateviewitem.hxx 
b/sfx2/inc/sfx2/templateviewitem.hxx
index b19a060..0a3cb3e 100644
--- a/sfx2/inc/sfx2/templateviewitem.hxx
+++ b/sfx2/inc/sfx2/templateviewitem.hxx
@@ -42,6 +42,10 @@ public:
 
     virtual void Paint (drawinglayer::processor2d::BaseProcessor2D *pProcessor,
                         const ThumbnailItemAttributes *pAttrs);
+
+    sal_uInt16    mnRegionId;
+    sal_uInt16    mnDocId;
+
 private:
 
     rtl::OUString maPath;
diff --git a/sfx2/inc/sfx2/thumbnailview.hxx b/sfx2/inc/sfx2/thumbnailview.hxx
index bc5aae9..78e1df6 100644
--- a/sfx2/inc/sfx2/thumbnailview.hxx
+++ b/sfx2/inc/sfx2/thumbnailview.hxx
@@ -236,6 +236,8 @@ public:
 
     virtual void Resize();
 
+    virtual void renameItem(ThumbnailViewItem* pItem, rtl::OUString sNewTitle);
+
 protected:
 
     virtual void MouseButtonDown( const MouseEvent& rMEvt );
diff --git a/sfx2/inc/sfx2/thumbnailviewitem.hxx 
b/sfx2/inc/sfx2/thumbnailviewitem.hxx
index 18b7eae..2acc8de 100644
--- a/sfx2/inc/sfx2/thumbnailviewitem.hxx
+++ b/sfx2/inc/sfx2/thumbnailviewitem.hxx
@@ -25,6 +25,7 @@
 #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
 #include <osl/mutex.hxx>
 #include <vcl/bitmapex.hxx>
+#include <vcl/vclmedit.hxx>
 #include "sfx2/dllapi.h"
 
 #include <com/sun/star/accessibility/XAccessible.hpp>
@@ -88,12 +89,17 @@ public:
 
     void setHighlight (bool state);
 
+    void setEditTitle (bool edit, bool bChangeFocus = true);
+    void updateTitleEditSize ();
+    virtual void setTitle (const rtl::OUString& rTitle);
+
     ::com::sun::star::uno::Reference< 
::com::sun::star::accessibility::XAccessible >
                         GetAccessible( bool bIsTransientChildrenDisabled );
 
     void setDrawArea (const Rectangle &area);
 
     const Rectangle& getDrawArea () const { return maDrawArea; }
+    Rectangle getTextArea () const;
 
     virtual void calculateItemsPosition (const long nThumbnailHeight, const 
long nDisplayHeight,
                                          const long nPadding, sal_uInt32 
nMaxTextLenght,
@@ -118,6 +124,9 @@ protected:
     Point maPrev1Pos;
     Rectangle maDrawArea;
     Link maClickHdl;
+    bool mbEditTitle;
+    VclMultiLineEdit* mpTitleED;
+    Rectangle maTextEditMaxArea;
 };
 
 #endif // THUMBNAILVIEWITEM_HXX
diff --git a/sfx2/source/control/templatelocalview.cxx 
b/sfx2/source/control/templatelocalview.cxx
index 2cacc9b..e42f9c8 100644
--- a/sfx2/source/control/templatelocalview.cxx
+++ b/sfx2/source/control/templatelocalview.cxx
@@ -37,6 +37,7 @@ TemplateLocalView::TemplateLocalView ( Window* pParent, const 
ResId& rResId, boo
       mpDocTemplates(new SfxDocumentTemplates)
 {
     mpItemView->SetColor(GetSettings().GetStyleSettings().GetFieldColor());
+    mpItemView->setMasterView(this);
 }
 
 TemplateLocalView::~TemplateLocalView()
@@ -63,7 +64,7 @@ void TemplateLocalView::Populate ()
             OUString aName = mpDocTemplates->GetName(i,j);
             OUString aURL = mpDocTemplates->GetPath(i,j);
 
-            TemplateItemProperties aProperties;;
+            TemplateItemProperties aProperties;
             aProperties.nId = j+1;
             aProperties.nDocId = j;
             aProperties.nRegionId = i;
@@ -570,6 +571,24 @@ bool TemplateLocalView::isTemplateNameUnique(const 
sal_uInt16 nRegionItemId, con
     return true;
 }
 
+void TemplateLocalView::renameItem(ThumbnailViewItem* pItem, rtl::OUString 
sNewTitle)
+{
+    sal_uInt16 nRegionId = 0;
+    sal_uInt16 nDocId = USHRT_MAX;
+    TemplateViewItem* pDocItem = dynamic_cast<TemplateViewItem*>( pItem );
+    TemplateContainerItem* pContainerItem = 
dynamic_cast<TemplateContainerItem*>( pItem );
+    if ( pDocItem )
+    {
+        nRegionId = pDocItem->mnRegionId;
+        nDocId = pDocItem->mnDocId;
+    }
+    else if ( pContainerItem )
+    {
+        nRegionId = pContainerItem->mnId - 1;
+    }
+    mpDocTemplates->SetName( sNewTitle, nRegionId, nDocId );
+}
+
 static void lcl_updateThumbnails (TemplateContainerItem *pItem)
 {
     pItem->maPreview1.Clear();
diff --git a/sfx2/source/control/templateview.cxx 
b/sfx2/source/control/templateview.cxx
index 4a44ea0..7073a6f 100644
--- a/sfx2/source/control/templateview.cxx
+++ b/sfx2/source/control/templateview.cxx
@@ -9,6 +9,7 @@
 
 #include "templatedlg.hxx"
 #include <sfx2/templateview.hxx>
+#include <sfx2/templateabstractview.hxx>
 
 #include <basegfx/matrix/b2dhommatrixtools.hxx>
 #include <basegfx/point/b2dpoint.hxx>
@@ -34,6 +35,7 @@ using namespace drawinglayer::primitive2d;
 
 TemplateView::TemplateView (Window *pParent)
     : ThumbnailView(pParent,WB_VSCROLL),
+      mpMasterView(NULL),
       maButtons(this, SfxResId(CONTROL_BUTTONS)),
       maAllButton(&maButtons, SfxResId(BTN_ALL_TEMPLATES)),
       maFTName(&maButtons, SfxResId(FT_NAME)),
@@ -61,6 +63,8 @@ void TemplateView::InsertItems (const 
std::vector<TemplateItemProperties> &rTemp
         const TemplateItemProperties *pCur = &rTemplates[i];
 
         pItem->mnId = pCur->nId;
+        pItem->mnDocId = pCur->nDocId;
+        pItem->mnRegionId = pCur->nRegionId;
         pItem->maTitle = pCur->aName;
         pItem->setPath(pCur->aPath);
         pItem->maPreview1 = pCur->aThumbnail;
@@ -96,6 +100,12 @@ void TemplateView::Resize()
     ThumbnailView::Resize();
 }
 
+void TemplateView::renameItem(ThumbnailViewItem* pItem, rtl::OUString 
sNewTitle)
+{
+    if (mpMasterView)
+        mpMasterView->renameItem(pItem, sNewTitle);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
 
 
diff --git a/sfx2/source/control/templateviewitem.cxx 
b/sfx2/source/control/templateviewitem.cxx
index 9f06ebb..94ce4d3 100644
--- a/sfx2/source/control/templateviewitem.cxx
+++ b/sfx2/source/control/templateviewitem.cxx
@@ -28,7 +28,9 @@ using namespace drawinglayer::attribute;
 using namespace drawinglayer::primitive2d;
 
 TemplateViewItem::TemplateViewItem (ThumbnailView &rView)
-    : ThumbnailViewItem(rView)
+    : ThumbnailViewItem(rView),
+      mnRegionId(USHRT_MAX),
+      mnDocId(USHRT_MAX)
 {
 }
 
diff --git a/sfx2/source/control/thumbnailview.cxx 
b/sfx2/source/control/thumbnailview.cxx
index d2196eb..a1c08980 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -505,6 +505,9 @@ void ThumbnailView::MouseButtonDown( const MouseEvent& 
rMEvt )
                     deselectItems( );
                 pItem->setSelection(true);
 
+                bool bClickOnTitle = 
pItem->getTextArea().IsInside(rMEvt.GetPosPixel());
+                pItem->setEditTitle(bClickOnTitle);
+
                 if (!pItem->isHighlighted())
                     DrawItem(pItem);
 
@@ -881,6 +884,7 @@ void ThumbnailView::deselectItems()
     {
         if (mItemList[i]->isSelected())
         {
+            mItemList[i]->setEditTitle(false);
             mItemList[i]->setSelection(false);
 
             maItemStateHdl.Call(mItemList[i]);
@@ -965,6 +969,11 @@ void ThumbnailView::sortItems (const boost::function<bool 
(const ThumbnailViewIt
     Invalidate();
 }
 
+void ThumbnailView::renameItem(ThumbnailViewItem*, rtl::OUString)
+{
+    // Do nothing by default
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
 
 
diff --git a/sfx2/source/control/thumbnailviewitem.cxx 
b/sfx2/source/control/thumbnailviewitem.cxx
index 2e6eb96..c228bab 100644
--- a/sfx2/source/control/thumbnailviewitem.cxx
+++ b/sfx2/source/control/thumbnailviewitem.cxx
@@ -19,6 +19,7 @@
 
 #include <sfx2/thumbnailviewitem.hxx>
 
+#include "thumbnailview.hxx"
 #include "thumbnailviewacc.hxx"
 
 #include <basegfx/matrix/b2dhommatrixtools.hxx>
@@ -42,6 +43,66 @@ using namespace ::com::sun::star;
 using namespace drawinglayer::attribute;
 using namespace drawinglayer::primitive2d;
 
+class ResizableMultiLineEdit : public VclMultiLineEdit
+{
+    private:
+        ThumbnailViewItem* mpItem;
+        bool mbIsInGrabFocus;
+
+    public:
+        ResizableMultiLineEdit (Window* pParent, ThumbnailViewItem* pItem);
+        ~ResizableMultiLineEdit ();
+
+        void SetInGrabFocus(bool bInGrabFocus) { mbIsInGrabFocus = 
bInGrabFocus; }
+
+        virtual long PreNotify(NotifyEvent& rNEvt);
+        virtual void Modify();
+};
+
+ResizableMultiLineEdit::ResizableMultiLineEdit (Window* pParent, 
ThumbnailViewItem* pItem) :
+    VclMultiLineEdit (pParent, WB_CENTER | WB_BORDER),
+    mpItem(pItem),
+    mbIsInGrabFocus(false)
+{
+}
+
+ResizableMultiLineEdit::~ResizableMultiLineEdit ()
+{
+}
+
+long ResizableMultiLineEdit::PreNotify(NotifyEvent& rNEvt)
+{
+    long nDone = 0;
+    if( rNEvt.GetType() == EVENT_KEYINPUT )
+    {
+        const KeyEvent& rKEvt = *rNEvt.GetKeyEvent();
+        KeyCode aCode = rKEvt.GetKeyCode();
+        switch (aCode.GetCode())
+        {
+            case KEY_RETURN:
+                mpItem->setTitle( GetText() );
+            case KEY_ESCAPE:
+                mpItem->setEditTitle(false);
+                nDone = 1;
+                break;
+            default:
+                break;
+        }
+    }
+    else if ( rNEvt.GetType() == EVENT_LOSEFOCUS && !mbIsInGrabFocus )
+    {
+        mpItem->setTitle( GetText() );
+        mpItem->setEditTitle(false, false);
+    }
+    return nDone ? nDone : VclMultiLineEdit::PreNotify(rNEvt);
+}
+
+void ResizableMultiLineEdit::Modify()
+{
+    VclMultiLineEdit::Modify();
+    mpItem->updateTitleEditSize();
+}
+
 ThumbnailViewItem::ThumbnailViewItem(ThumbnailView &rView)
     : mrParent(rView)
     , mnId(0)
@@ -49,11 +110,16 @@ ThumbnailViewItem::ThumbnailViewItem(ThumbnailView &rView)
     , mbSelected(false)
     , mbHover(false)
     , mpxAcc(NULL)
+    , mbEditTitle(false)
+    , mpTitleED(NULL)
+    , maTextEditMaxArea()
 {
+    mpTitleED = new ResizableMultiLineEdit(&rView, this);
 }
 
 ThumbnailViewItem::~ThumbnailViewItem()
 {
+    delete mpTitleED;
     if( mpxAcc )
     {
         static_cast< ThumbnailViewItemAcc* >( mpxAcc->get() 
)->ParentDestroyed();
@@ -64,6 +130,8 @@ ThumbnailViewItem::~ThumbnailViewItem()
 void ThumbnailViewItem::show (bool bVisible)
 {
     mbVisible = bVisible;
+    if (!mbVisible)
+        mpTitleED->Show(false);
 }
 
 void ThumbnailViewItem::setSelection (bool state)
@@ -76,6 +144,53 @@ void ThumbnailViewItem::setHighlight (bool state)
     mbHover = state;
 }
 
+void ThumbnailViewItem::setEditTitle (bool edit, bool bChangeFocus)
+{
+    mbEditTitle = edit;
+    mpTitleED->Show(edit);
+    if (edit)
+    {
+        mpTitleED->SetText(maTitle);
+        updateTitleEditSize();
+        static_cast<ResizableMultiLineEdit*>(mpTitleED)->SetInGrabFocus(true);
+        mpTitleED->GrabFocus();
+        static_cast<ResizableMultiLineEdit*>(mpTitleED)->SetInGrabFocus(false);
+    }
+    else if (bChangeFocus)
+    {
+        mrParent.GrabFocus();
+    }
+}
+
+Rectangle ThumbnailViewItem::getTextArea() const
+{
+    Rectangle aTextArea(maTextEditMaxArea);
+
+    TextEngine aTextEngine;
+    aTextEngine.SetMaxTextWidth(maDrawArea.getWidth());
+    aTextEngine.SetText(maTitle);
+
+    long nTxtHeight = aTextEngine.GetTextHeight() + 6;
+    if (nTxtHeight < aTextArea.GetHeight())
+        aTextArea.SetSize(Size(aTextArea.GetWidth(), nTxtHeight));
+
+    return aTextArea;
+}
+
+void ThumbnailViewItem::updateTitleEditSize()
+{
+    Rectangle aTextArea = getTextArea();
+    Point aPos = aTextArea.TopLeft();
+    Size aSize = aTextArea.GetSize();
+    mpTitleED->SetPosSizePixel(aPos, aSize);
+}
+
+void ThumbnailViewItem::setTitle (const rtl::OUString& rTitle)
+{
+    mrParent.renameItem(this, rTitle);
+    maTitle = rTitle;
+}
+
 uno::Reference< accessibility::XAccessible > ThumbnailViewItem::GetAccessible( 
bool bIsTransientChildrenDisabled )
 {
     if( !mpxAcc )
@@ -108,9 +223,15 @@ void ThumbnailViewItem::calculateItemsPosition (const long 
nThumbnailHeight, con
     maPrev1Pos = aPos;
 
     // Calculate text position
-    aPos.Y() = maDrawArea.getY() + nThumbnailHeight + nPadding + 
aTextDev.getTextHeight();
+    aPos.Y() = maDrawArea.getY() + nThumbnailHeight + nPadding * 2;
     aPos.X() = maDrawArea.Left() + (aRectSize.Width() - 
aTextDev.getTextWidth(maTitle,0,nMaxTextLenght))/2;
     maTextPos = aPos;
+
+    // Calculate the text edit max area
+    aPos = Point(maDrawArea.getX() + nPadding, maTextPos.getY());
+    Size aEditSize(maDrawArea.GetWidth() - nPadding * 2,
+                   maDrawArea.Bottom() - maTextPos.Y());
+    maTextEditMaxArea = Rectangle( aPos, aEditSize );
 }
 
 void ThumbnailViewItem::setSelectClickHdl (const Link &link)
@@ -162,8 +283,7 @@ void ThumbnailViewItem::Paint 
(drawinglayer::processor2d::BaseProcessor2D *pProc
 
     // Draw text below thumbnail
     aPos = maTextPos;
-
-    addTextPrimitives( maTitle, pAttrs, maTextPos, aSeq );
+    addTextPrimitives( maTitle, pAttrs, aPos, aSeq );
 
     pProcessor->process(aSeq);
 }
@@ -172,6 +292,8 @@ void ThumbnailViewItem::addTextPrimitives (const 
rtl::OUString& rText, const Thu
 {
     drawinglayer::primitive2d::TextLayouterDevice aTextDev;
 
+    aPos.setY(aPos.getY() + aTextDev.getTextHeight());
+
     rtl::OUString aText (rText);
 
     TextEngine aTextEngine;
diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx
index f1e7e97..9c171ee 100644
--- a/sfx2/source/doc/doctempl.cxx
+++ b/sfx2/source/doc/doctempl.cxx
@@ -1039,6 +1039,61 @@ sal_Bool SfxDocumentTemplates::InsertDir
     return sal_False;
 }
 
+sal_Bool SfxDocumentTemplates::SetName( const OUString& rName, sal_uInt16 
nRegion, sal_uInt16 nIdx )
+
+{
+    DocTemplLocker_Impl aLocker( *pImp );
+
+    if ( ! pImp->Construct() )
+        return sal_False;
+
+    RegionData_Impl *pRegion = pImp->GetRegion( nRegion );
+    DocTempl_EntryData_Impl *pEntry = NULL;
+
+    if ( !pRegion )
+        return sal_False;
+
+    uno::Reference< XDocumentTemplates > xTemplates = pImp->getDocTemplates();
+    OUString aEmpty;
+
+    if ( nIdx == USHRT_MAX )
+    {
+        if ( pRegion->GetTitle() == rName )
+            return sal_True;
+
+        // we have to rename a region
+        if ( xTemplates->renameGroup( pRegion->GetTitle(), rName ) )
+        {
+            pRegion->SetTitle( rName );
+            pRegion->SetTargetURL( aEmpty );
+            pRegion->SetHierarchyURL( aEmpty );
+            return sal_True;
+        }
+    }
+    else
+    {
+        pEntry = pRegion->GetEntry( nIdx );
+
+        if ( !pEntry )
+            return sal_False;
+
+        if ( pEntry->GetTitle() == rName )
+            return sal_True;
+
+        if ( xTemplates->renameTemplate( pRegion->GetTitle(),
+                                         pEntry->GetTitle(),
+                                         rName ) )
+        {
+            pEntry->SetTitle( rName );
+            pEntry->SetTargetURL( aEmpty );
+            pEntry->SetHierarchyURL( aEmpty );
+            return sal_True;
+        }
+    }
+
+    return sal_False;
+}
+
 //------------------------------------------------------------------------
 
 sal_Bool SfxDocumentTemplates::GetFull
commit 7b384313399ee8199cd7241527c3dbc1d50694a2
Author: Cédric Bosdonnat <[email protected]>
Date:   Mon Feb 11 15:24:23 2013 +0100

    Fixed SfxDocTplService_Impl::setTitleForURL to keep all streams.
    
    After commit 117fdb98, the setTitleForURL only wrote the meta.xml file
    to the odf container, dropping all the other streams. Use storeToStorage
    as in the old implementation to fix the problem.
    
    Even though marginal, this problem is important for templates renaming.

diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index 94ba00b..d85ca00 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -32,6 +32,7 @@
 #include <comphelper/componentcontext.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/sequenceashashmap.hxx>
+#include <comphelper/storagehelper.hxx>
 #include <comphelper/string.hxx>
 #include <com/sun/star/beans/PropertyAttribute.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
@@ -639,8 +640,18 @@ sal_Bool SfxDocTplService_Impl::setTitleForURL( const 
OUString& rURL, const OUSt
         try
         {
             m_xDocProps->loadFromMedium(rURL, Sequence<PropertyValue>());
-            m_xDocProps->setTitle(aTitle );
-            m_xDocProps->storeToMedium(rURL, Sequence<PropertyValue>());
+            m_xDocProps->setTitle(aTitle);
+
+            uno::Reference< embed::XStorage > xStorage = 
::comphelper::OStorageHelper::GetStorageFromURL(
+                    rURL, embed::ElementModes::READWRITE);
+
+            uno::Sequence<beans::PropertyValue> medium(2);
+            medium[0].Name = ::rtl::OUString("DocumentBaseURL");
+            medium[0].Value <<= rURL;
+            medium[1].Name = ::rtl::OUString("URL");
+            medium[1].Value <<= rURL;
+
+            m_xDocProps->storeToStorage(xStorage, medium);
             return true;
         }
         catch ( Exception& )
_______________________________________________
Libreoffice-commits mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to