[Libreoffice-commits] .: Branch 'libreoffice-3-6' - 11 commits - basctl/source basic/source l10ntools/source svtools/source svx/inc svx/source

Andras Timar timar at kemper.freedesktop.org
Fri Aug 10 12:51:56 PDT 2012


 basctl/source/basicide/basides1.cxx            |    3 
 basctl/source/basicide/basidesh.cxx            |    6 
 basctl/source/basicide/bastype2.cxx            |   34 +++
 basctl/source/basicide/bastype2.hxx            |    2 
 basctl/source/basicide/objdlg.cxx              |    7 
 basctl/source/basicide/objdlg.hxx              |    2 
 basic/source/runtime/methods.cxx               |   11 -
 l10ntools/source/help/HelpCompiler.cxx         |  219 ++++++++-----------------
 l10ntools/source/help/HelpCompiler.hxx         |    2 
 svtools/source/edit/textview.cxx               |    4 
 svx/inc/tbunosearchcontrollers.hxx             |    6 
 svx/source/svdraw/svdotext.cxx                 |    2 
 svx/source/tbxctrls/tbunosearchcontrollers.cxx |   70 +++++--
 13 files changed, 181 insertions(+), 187 deletions(-)

New commits:
commit b0aac2a42566185dd9809e8ded8231a2162bfcba
Author: Noel Power <noel.power at novell.com>
Date:   Tue Jul 31 14:25:29 2012 +0100

    tweak for commit 8181dddb7bf166be4a00e9280d52f8d7a1741290 fdo#42492
    
    avoid char buffer and snprintf.
    
    Change-Id: Ia83cfc9333591bcb3b191679ccf2be587b4be243
    Signed-off-by: Andras Timar <atimar at suse.com>

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 49ebf27..d54c506 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -872,14 +872,12 @@ RTLFUNC(Hex)
         StarBASIC::Error( SbERR_BAD_ARGUMENT );
     else
     {
-        char aBuffer[17];
         SbxVariableRef pArg = rPar.Get( 1 );
-        // converting value to unsigned
+        // converting value to unsigned and limit to 2 or 4 byte representation
         sal_uInt32 nVal = pArg->IsInteger() ?
             static_cast<sal_uInt16>(pArg->GetInteger()) :
             static_cast<sal_uInt32>(pArg->GetLong());
-        snprintf( aBuffer, sizeof(aBuffer), "%"SAL_PRIXUINT32, nVal );
-        rPar.Get(0)->PutString( rtl::OUString::createFromAscii( aBuffer ) );
+        rPar.Get(0)->PutString( rtl::OUString::valueOf( sal_Int64(nVal), 16 ) );
     }
 }
 
commit 8f08ad4deeb0e5bce7a137ff1d678b71ce74377a
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Thu Aug 9 11:30:35 2012 +0200

    Minor cleanup.
    
    Change-Id: I087043b36d59e1a76c6fe12a5a684c4137eca2d9
    Signed-off-by: Andras Timar <atimar at suse.com>

diff --git a/svx/inc/tbunosearchcontrollers.hxx b/svx/inc/tbunosearchcontrollers.hxx
index 490a3f0..8fb7d33 100644
--- a/svx/inc/tbunosearchcontrollers.hxx
+++ b/svx/inc/tbunosearchcontrollers.hxx
@@ -96,7 +96,7 @@ private:
     typedef ::comphelper::SequenceAsVector< css::beans::PropertyValue > SearchToolbarControllersVec;
     typedef ::std::map< css::uno::Reference< css::frame::XFrame >, SearchToolbarControllersVec > SearchToolbarControllersMap;
     SearchToolbarControllersMap aSearchToolbarControllersMap;
-    std::vector<rtl::OUString>    aSearchStrings;
+    std::vector<rtl::OUString> m_aSearchStrings;
 
 };
 
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
index 4deaf8c..d645ba9 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -119,7 +119,7 @@ void FindTextFieldControl::Remember_Impl(const String& rStr)
 
 void FindTextFieldControl::SetTextToSelected_Impl()
 {
-    OUString aString;
+    rtl::OUString aString;
 
     try
     {
@@ -212,7 +212,7 @@ long FindTextFieldControl::PreNotify( NotifyEvent& rNEvt )
         case EVENT_GETFOCUS:
             if ( m_bToClearTextField )
             {
-                SetText( OUString() );
+                SetText( rtl::OUString() );
                 m_bToClearTextField = sal_False;
             }
             SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) );
@@ -257,21 +257,21 @@ SearchToolbarControllersManager& SearchToolbarControllersManager::createControll
     return theSearchToolbarControllersManager::get();
 }
 
-void SearchToolbarControllersManager::saveSearchHistory(const FindTextFieldControl* m_pFindTextFieldControl)
+void SearchToolbarControllersManager::saveSearchHistory(const FindTextFieldControl* pFindTextFieldControl)
 {
-    sal_uInt16 nECount( m_pFindTextFieldControl->GetEntryCount() );
-    aSearchStrings.resize( nECount );
+    sal_uInt16 nECount( pFindTextFieldControl->GetEntryCount() );
+    m_aSearchStrings.resize( nECount );
     for( sal_uInt16 i=0; i<nECount; ++i )
     {
-        aSearchStrings[i] = m_pFindTextFieldControl->GetEntry(i);
+        m_aSearchStrings[i] = pFindTextFieldControl->GetEntry(i);
     }
 }
 
-void SearchToolbarControllersManager::loadSearchHistory(FindTextFieldControl* m_pFindTextFieldControl)
+void SearchToolbarControllersManager::loadSearchHistory(FindTextFieldControl* pFindTextFieldControl)
 {
-    for( sal_uInt16 i=0; i<aSearchStrings.size(); ++i )
+    for( sal_uInt16 i=0; i<m_aSearchStrings.size(); ++i )
     {
-       m_pFindTextFieldControl->InsertEntry(aSearchStrings[i],i);
+        pFindTextFieldControl->InsertEntry(m_aSearchStrings[i],i);
     }
 }
 
commit b68ad0ba9ceb8bdfc9fc3a3211c254824d38c267
Author: Zolnai Tamás <zolniatamas at caesar.elte.hu>
Date:   Fri Aug 10 09:32:03 2012 +0200

    fdo#37791 Insert selected text to Findbar by Ctrl F
    
    The dispatch function of FindbarDispatcher class is called when
    Ctrl+f is pressed. This function makes Toolbar visible and takes
    focus to TextField. So expand this function to insert the selected
    text to TextField at the same time. With dynamic_cast convert
    Window pointer, which point to the TextField and call TextField's new
    function: SetTextToSelected_Impl(), which makes the mentioned
    insertion.
    Plus make a little cleanup. Replace one string, which is defined by
    a macro.
    
    Change-Id: I2a8a3b10a016f5b28ea58fa3e63a3f31c9a816bf
    Signed-off-by: Andras Timar <atimar at suse.com>

diff --git a/svx/inc/tbunosearchcontrollers.hxx b/svx/inc/tbunosearchcontrollers.hxx
index 91ddec8..490a3f0 100644
--- a/svx/inc/tbunosearchcontrollers.hxx
+++ b/svx/inc/tbunosearchcontrollers.hxx
@@ -65,6 +65,7 @@ public:
 
     void InitControls_Impl();
     void Remember_Impl(const String& rStr);
+    void SetTextToSelected_Impl();
 
 private:
 
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
index f53dab2..4deaf8c 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -117,6 +117,32 @@ void FindTextFieldControl::Remember_Impl(const String& rStr)
     InsertEntry(rStr, 0);
 }
 
+void FindTextFieldControl::SetTextToSelected_Impl()
+{
+    OUString aString;
+
+    try
+    {
+        css::uno::Reference<css::frame::XController> xController(m_xFrame->getController(), css::uno::UNO_QUERY_THROW);
+        css::uno::Reference<css::frame::XModel> xModel(xController->getModel(), css::uno::UNO_QUERY_THROW);
+        css::uno::Reference<css::container::XIndexAccess> xIndexAccess(xModel->getCurrentSelection(), css::uno::UNO_QUERY_THROW);
+        if (xIndexAccess->getCount() > 0)
+        {
+            css::uno::Reference<css::text::XTextRange> xTextRange(xIndexAccess->getByIndex(0), css::uno::UNO_QUERY_THROW);
+            aString = xTextRange->getString();
+        }
+    }
+    catch ( ... )
+    {
+    }
+
+    if ( aString.getLength() != 0 )
+    {
+        SetText( aString );
+        m_bToClearTextField = sal_False;
+    }
+}
+
 void FindTextFieldControl::Modify()
 {
     ComboBox::Modify();
@@ -186,24 +212,7 @@ long FindTextFieldControl::PreNotify( NotifyEvent& rNEvt )
         case EVENT_GETFOCUS:
             if ( m_bToClearTextField )
             {
-                String aString;
-
-                try
-                {
-                    css::uno::Reference<css::frame::XController> xController(m_xFrame->getController(), css::uno::UNO_QUERY_THROW);
-                    css::uno::Reference<css::frame::XModel> xModel(xController->getModel(), css::uno::UNO_QUERY_THROW);
-                    css::uno::Reference<css::container::XIndexAccess> xIndexAccess(xModel->getCurrentSelection(), css::uno::UNO_QUERY_THROW);
-                    if (xIndexAccess->getCount() > 0)
-                    {
-                        css::uno::Reference<css::text::XTextRange> xTextRange(xIndexAccess->getByIndex(0), css::uno::UNO_QUERY_THROW);
-                        aString = xTextRange->getString();
-                    }
-                }
-                catch ( ... )
-                {
-                }
-
-                SetText( aString );
+                SetText( OUString() );
                 m_bToClearTextField = sal_False;
             }
             SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) );
@@ -760,11 +769,14 @@ void SAL_CALL FindbarDispatcher::dispatch( const css::util::URL& aURL, const css
             for ( sal_uInt16 i=0; i<nItemCount; ++i )
             {
                 ::rtl::OUString sItemCommand = pToolBox->GetItemCommand(i);
-                if ( sItemCommand == ".uno:FindText" )
+                if ( sItemCommand == COMMAND_FINDTEXT )
                 {
                     Window* pItemWin = pToolBox->GetItemWindow( i );
                     if ( pItemWin )
                     {
+                        FindTextFieldControl* pFindTextFieldControl = dynamic_cast<FindTextFieldControl*>(pItemWin);
+                        if ( pFindTextFieldControl )
+                            pFindTextFieldControl->SetTextToSelected_Impl();
                         pItemWin->GrabFocus();
                         return;
                     }
commit 35b6007b7f62b75a3e6ec924fa5863cd6e7a53e0
Author: Zolnai Tamás <zolniatamas at caesar.elte.hu>
Date:   Wed Aug 8 20:50:35 2012 +0200

    fdo#49750 Search Toolbar keeps its history
    
    Until now, only the ToolBar's TextField stored the history, but
    this is destructed when ToolBar is closed. The "Manager" class is alive
    in case of Toolbar's invisibility, so I made this class to store history
    temporarly.
    
    Change-Id: I816dd3c83440000ab4e6caaeb2cccf390d3042fd
    Signed-off-by: Andras Timar <atimar at suse.com>

diff --git a/svx/inc/tbunosearchcontrollers.hxx b/svx/inc/tbunosearchcontrollers.hxx
index 032662c..91ddec8 100644
--- a/svx/inc/tbunosearchcontrollers.hxx
+++ b/svx/inc/tbunosearchcontrollers.hxx
@@ -46,6 +46,7 @@
 #include <vcl/window.hxx>
 
 #include <map>
+#include <vector>
 
 namespace css = ::com::sun::star        ;
 namespace svx
@@ -86,11 +87,15 @@ public:
     void freeController ( const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Reference< css::frame::XStatusListener >& xStatusListener, const ::rtl::OUString& sCommandURL );
     css::uno::Reference< css::frame::XStatusListener > findController( const css::uno::Reference< css::frame::XFrame >& xFrame, const ::rtl::OUString& sCommandURL );
 
+    void saveSearchHistory(const FindTextFieldControl* m_pFindTextFieldControl);
+    void loadSearchHistory(FindTextFieldControl* m_pFindTextFieldControl);
+
 private:
 
     typedef ::comphelper::SequenceAsVector< css::beans::PropertyValue > SearchToolbarControllersVec;
     typedef ::std::map< css::uno::Reference< css::frame::XFrame >, SearchToolbarControllersVec > SearchToolbarControllersMap;
     SearchToolbarControllersMap aSearchToolbarControllersMap;
+    std::vector<rtl::OUString>    aSearchStrings;
 
 };
 
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
index 5fddc89..f53dab2 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -248,6 +248,24 @@ SearchToolbarControllersManager& SearchToolbarControllersManager::createControll
     return theSearchToolbarControllersManager::get();
 }
 
+void SearchToolbarControllersManager::saveSearchHistory(const FindTextFieldControl* m_pFindTextFieldControl)
+{
+    sal_uInt16 nECount( m_pFindTextFieldControl->GetEntryCount() );
+    aSearchStrings.resize( nECount );
+    for( sal_uInt16 i=0; i<nECount; ++i )
+    {
+        aSearchStrings[i] = m_pFindTextFieldControl->GetEntry(i);
+    }
+}
+
+void SearchToolbarControllersManager::loadSearchHistory(FindTextFieldControl* m_pFindTextFieldControl)
+{
+    for( sal_uInt16 i=0; i<aSearchStrings.size(); ++i )
+    {
+       m_pFindTextFieldControl->InsertEntry(aSearchStrings[i],i);
+    }
+}
+
 void SearchToolbarControllersManager::registryController( const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Reference< css::frame::XStatusListener >& xStatusListener, const ::rtl::OUString& sCommandURL )
 {
     SearchToolbarControllersMap::iterator pIt = aSearchToolbarControllersMap.find(xFrame);
@@ -384,6 +402,7 @@ void SAL_CALL FindTextToolbarController::dispose() throw ( css::uno::RuntimeExce
     SearchToolbarControllersManager::createControllersManager().freeController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL);
 
     svt::ToolboxController::dispose();
+    SearchToolbarControllersManager::createControllersManager().saveSearchHistory(m_pFindTextFieldControl);
     delete m_pFindTextFieldControl;
     m_pFindTextFieldControl = 0;
 }
@@ -430,6 +449,7 @@ css::uno::Reference< css::awt::XWindow > SAL_CALL FindTextToolbarController::cre
         Size aSize(250, m_pFindTextFieldControl->GetTextHeight() + 200);
         m_pFindTextFieldControl->SetSizePixel( aSize );
         m_pFindTextFieldControl->SetModifyHdl(LINK(this, FindTextToolbarController, EditModifyHdl));
+        SearchToolbarControllersManager::createControllersManager().loadSearchHistory(m_pFindTextFieldControl);
     }
     xItemWindow = VCLUnoHelper::GetInterface( m_pFindTextFieldControl );
 
commit e370b12af6e2c1e3fc3bf67350541c4e4503f40c
Author: Uray M. János <uray.janos at gmail.com>
Date:   Tue Jul 31 08:04:06 2012 +0200

    fdo#42492: fixing Basic HEX command
    
    Change-Id: I133590c9f2a34d8daab031da0c77bd049d275c29
    Signed-off-by: Andras Timar <atimar at suse.com>

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 9a5bb7d..49ebf27 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -872,13 +872,14 @@ RTLFUNC(Hex)
         StarBASIC::Error( SbERR_BAD_ARGUMENT );
     else
     {
-        char aBuffer[16];
+        char aBuffer[17];
         SbxVariableRef pArg = rPar.Get( 1 );
-        if ( pArg->IsInteger() )
-            snprintf( aBuffer, sizeof(aBuffer), "%X", pArg->GetInteger() );
-        else
-            snprintf( aBuffer, sizeof(aBuffer), "%lX", static_cast<long unsigned int>(pArg->GetLong()) );
-        rPar.Get(0)->PutString( String::CreateFromAscii( aBuffer ) );
+        // converting value to unsigned
+        sal_uInt32 nVal = pArg->IsInteger() ?
+            static_cast<sal_uInt16>(pArg->GetInteger()) :
+            static_cast<sal_uInt32>(pArg->GetLong());
+        snprintf( aBuffer, sizeof(aBuffer), "%"SAL_PRIXUINT32, nVal );
+        rPar.Get(0)->PutString( rtl::OUString::createFromAscii( aBuffer ) );
     }
 }
 
commit 3947c90f4bb15f272ecee86609953638302753f5
Author: Uray M. János <uray.janos at gmail.com>
Date:   Mon Jul 30 11:42:16 2012 +0200

    fdo#46968 fixing undo of textbox resizing
    
    Change-Id: Ic647e5c337987985f749b67113892a01f74ee8f9
    Signed-off-by: Andras Timar <atimar at suse.com>

diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index b274da8..6ea04de 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1457,7 +1457,7 @@ void SdrTextObj::RestGeoData(const SdrObjGeoData& rGeo)
 { // RectsDirty is called by SdrObject
     SdrAttrObj::RestGeoData(rGeo);
     SdrTextObjGeoData& rTGeo=(SdrTextObjGeoData&)rGeo;
-    aRect  =rTGeo.aRect;
+    NbcSetLogicRect(rTGeo.aRect);
     aGeo   =rTGeo.aGeo;
     SetTextSizeDirty();
 }
commit 3784488acbe16c4581e164e3c9a0af9ad57c1cef
Author: Uray M. János <uray.janos at gmail.com>
Date:   Tue Jul 24 19:27:25 2012 +0200

    fdo#50632 IDE: update Object Catalog when closing a document
    
    Change-Id: Ia635aee1611eaff663906e2238bf23a5013242a3
    Signed-off-by: Andras Timar <atimar at suse.com>

diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx
index 9e78d75..5317a33 100644
--- a/basctl/source/basicide/bastype2.cxx
+++ b/basctl/source/basicide/bastype2.cxx
@@ -568,9 +568,12 @@ void BasicTreeListBox::onDocumentSaveAsDone( const ScriptDocument& /*_rDocument*
     UpdateEntries();
 }
 
-void BasicTreeListBox::onDocumentClosed( const ScriptDocument& /*_rDocument*/ )
+void BasicTreeListBox::onDocumentClosed( const ScriptDocument& rDocument )
 {
     UpdateEntries();
+    // The document is not yet actually deleted, so we need to remove its entry
+    // manually.
+    RemoveEntry(rDocument);
 }
 
 void BasicTreeListBox::onDocumentTitleChanged( const ScriptDocument& /*_rDocument*/ )
@@ -587,7 +590,7 @@ void BasicTreeListBox::UpdateEntries()
 {
     BasicEntryDescriptor aCurDesc( GetEntryDescriptor( FirstSelected() ) );
 
-
+    // removing the invalid entries
     SvLBoxEntry* pLastValid = 0;
     SvLBoxEntry* pEntry = First();
     while ( pEntry )
@@ -595,19 +598,36 @@ void BasicTreeListBox::UpdateEntries()
         if ( IsValidEntry( pEntry ) )
             pLastValid = pEntry;
         else
-        {
-            delete (BasicEntry*)pEntry->GetUserData();
-            GetModel()->Remove( pEntry );
-        }
+            RemoveEntry(pEntry);
         pEntry = pLastValid ? Next( pLastValid ) : First();
     }
 
-
     ScanAllEntries();
 
     SetCurrentEntry( aCurDesc );
 }
 
+// Removes the entry from the tree.
+void BasicTreeListBox::RemoveEntry (SvLBoxEntry* pEntry)
+{
+    // removing the associated user data
+    delete (BasicEntry*)pEntry->GetUserData();
+    // removing the entry
+    GetModel()->Remove( pEntry );
+}
+
+// Removes the entry of rDocument.
+void BasicTreeListBox::RemoveEntry (ScriptDocument const& rDocument)
+{
+    // finding the entry of rDocument
+    for (SvLBoxEntry* pEntry = First(); pEntry; pEntry = Next(pEntry))
+        if (rDocument == GetEntryDescriptor(pEntry).GetDocument())
+        {
+            RemoveEntry(pEntry);
+            break;
+        }
+}
+
 SvLBoxEntry* BasicTreeListBox::CloneEntry( SvLBoxEntry* pSource )
 {
     SvLBoxEntry* pNew = SvTreeListBox::CloneEntry( pSource );
diff --git a/basctl/source/basicide/bastype2.hxx b/basctl/source/basicide/bastype2.hxx
index 20aa7c5..2e4e2f5 100644
--- a/basctl/source/basicide/bastype2.hxx
+++ b/basctl/source/basicide/bastype2.hxx
@@ -208,6 +208,8 @@ public:
     SvLBoxEntry*    AddEntry( const ::rtl::OUString& rText, const Image& rImage,
                               SvLBoxEntry* pParent, bool bChildrenOnDemand,
                               std::auto_ptr< BasicEntry > aUserData );
+    void            RemoveEntry (SvLBoxEntry*);
+    void            RemoveEntry (ScriptDocument const&);
 
     ::rtl::OUString GetRootEntryName( const ScriptDocument& rDocument, LibraryLocation eLocation ) const;
     void            GetRootEntryBitmaps( const ScriptDocument& rDocument, Image& rImage );
commit 15ee0e20565962c82b0ce474ac54c200e83a2850
Author: Uray M. János <uray.janos at gmail.com>
Date:   Wed Jul 25 16:06:39 2012 +0200

    fixed Replace all message in Basic IDE
    
    Change-Id: I3e4fdb07ea5a1d1d47bcf190a5ee96800b44f89b
    Signed-off-by: Andras Timar <atimar at suse.com>

diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index 42f6df4..f7d5062 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -151,7 +151,7 @@ void BasicIDEShell::ExecuteCurrent( SfxRequest& rReq )
                 {
                     // memorize item because of the adjustments...
                     BasicIDEGlobals::GetExtraData()->SetSearchItem( (const SvxSearchItem&)rItem );
-                    sal_uInt16 nFound = 0;
+                    sal_Int32 nFound = 0;
                     sal_Bool bCanceled = sal_False;
                     if ( ((const SvxSearchItem&)rItem).GetCommand() == SVX_SEARCHCMD_REPLACE_ALL )
                     {
commit 24ec879f63f1d6525a06e870bc02458ea28db9d0
Author: Uray M. János <uray.janos at gmail.com>
Date:   Wed Jul 25 09:42:12 2012 +0200

    fdo#40152 replace with empty string in Basic IDE
    
    Change-Id: I2ee41160e5cb10694ccdb5a1cdaf7d4abfeb23bb
    Signed-off-by: Andras Timar <atimar at suse.com>

diff --git a/svtools/source/edit/textview.cxx b/svtools/source/edit/textview.cxx
index 75dbb5f..975b8df 100644
--- a/svtools/source/edit/textview.cxx
+++ b/svtools/source/edit/textview.cxx
@@ -1369,7 +1369,7 @@ void TextView::InsertNewText( const rtl::OUString& rStr, sal_Bool bSelect )
     */
     sal_Int32 nLen = rStr.getLength();
     sal_Int32 nPos = 0;
-    while( nLen )
+    do
     {
         sal_Int32 nChunkLen = nLen > 65534 ? 65534 : nLen;
         String aChunk( rStr.copy( nPos, nChunkLen ) );
@@ -1392,6 +1392,8 @@ void TextView::InsertNewText( const rtl::OUString& rStr, sal_Bool bSelect )
         nLen -= nChunkLen;
         nPos += nChunkLen;
     }
+    while( nLen );
+
     mpImpl->mpTextEngine->UndoActionEnd();
 
     mpImpl->mpTextEngine->FormatAndUpdate( this );
commit c0dd0edf2af6a3cd9fb2d71cc2a3ba14a22b855b
Author: Uray M. János <uray.janos at gmail.com>
Date:   Tue Jul 24 11:29:57 2012 +0200

    fdo#50633 IDE: select current module in Object Catalog on open
    
    Change-Id: Ieea731b0ed8eefdab616ed1f778b445aae14191c
    Signed-off-by: Andras Timar <atimar at suse.com>

diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index 69d773c..42f6df4 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -1209,6 +1209,7 @@ void BasicIDEShell::SetCurWindow( IDEBaseWindow* pNewWin, sal_Bool bUpdateTabBar
             GetViewFrame()->GetWindow().SetHelpId( HID_BASICIDE_MODULWINDOW );
             SfxObjectShell::SetCurrentComponent( NULL );
         }
+        pModulLayout->GetObjectCatalog().SetCurrentEntry(pCurWin);
         SetUndoManager( pCurWin ? pCurWin->GetUndoManager() : 0 );
         InvalidateBasicIDESlots();
         EnableScrollbars( pCurWin ? sal_True : sal_False );
diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx
index d2ced7e..c53cc8a 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -552,11 +552,7 @@ void BasicIDEShell::ShowObjectDialog( sal_Bool bShow, sal_Bool bCreateOrDestroy
             if ( pObjectCatalog )
             {
                 pObjectCatalog->SetCancelHdl( LINK( this, BasicIDEShell, ObjectDialogCancelHdl ) );
-                BasicEntryDescriptor aDesc;
-                IDEBaseWindow* pCurWin_ = GetCurWindow();
-                if ( pCurWin_ )
-                    aDesc = pCurWin_->CreateEntryDescriptor();
-                pObjectCatalog->SetCurrentEntry( aDesc );
+                pObjectCatalog->SetCurrentEntry(pCurWin);
             }
         }
 
diff --git a/basctl/source/basicide/objdlg.cxx b/basctl/source/basicide/objdlg.cxx
index 7e598de..0d112cb 100644
--- a/basctl/source/basicide/objdlg.cxx
+++ b/basctl/source/basicide/objdlg.cxx
@@ -232,9 +232,12 @@ void ObjectCatalog::UpdateEntries()
     aMacroTreeList.UpdateEntries();
 }
 
-void ObjectCatalog::SetCurrentEntry( BasicEntryDescriptor& rDesc )
+void ObjectCatalog::SetCurrentEntry (IDEBaseWindow* pCurWin)
 {
-    aMacroTreeList.SetCurrentEntry( rDesc );
+    BasicEntryDescriptor aDesc;
+    if (pCurWin)
+        aDesc = pCurWin->CreateEntryDescriptor();
+    aMacroTreeList.SetCurrentEntry(aDesc);
 }
 
 ObjectCatalogToolBox_Impl::ObjectCatalogToolBox_Impl(
diff --git a/basctl/source/basicide/objdlg.hxx b/basctl/source/basicide/objdlg.hxx
index 47e4651..9ed19bd 100644
--- a/basctl/source/basicide/objdlg.hxx
+++ b/basctl/source/basicide/objdlg.hxx
@@ -75,7 +75,7 @@ public:
     virtual ~ObjectCatalog();
 
     void                UpdateEntries();
-    void                SetCurrentEntry( BasicEntryDescriptor& rDesc );
+    void                SetCurrentEntry (IDEBaseWindow* pCurWin);
     void                SetCancelHdl( const Link& rLink ) { aCancelHdl = rLink; }
 };
 
commit 98277b849424b9b4f486b8deb00db0c47487267e
Author: Andras Bartek <barteka13 at gmail.com>
Date:   Mon Aug 6 16:25:37 2012 +0200

    fixing conditional text in ahelp tags fdo#49268
    
    Change-Id: Ife25790d2ef3ffbacc05a97ac682757b841a1eb8
    Signed-off-by: Andras Timar <atimar at suse.com>

diff --git a/l10ntools/source/help/HelpCompiler.cxx b/l10ntools/source/help/HelpCompiler.cxx
index fb92e5b..e28ac92 100644
--- a/l10ntools/source/help/HelpCompiler.cxx
+++ b/l10ntools/source/help/HelpCompiler.cxx
@@ -54,6 +54,10 @@ HelpCompiler::HelpCompiler(StreamTable &in_streamTable, const fs::path &in_input
     bExtensionMode( in_bExtensionMode )
 {
     xmlKeepBlanksDefaultValue = 0;
+    char* guitmp = getenv("GUI");
+    gui = (strcmp(guitmp, "UNX") ? gui : "UNIX");
+    gui = (strcmp(guitmp, "MAC") ? gui : "MAC");
+    gui = (strcmp(guitmp, "WNT") ? gui : "WIN");
 }
 
 xmlDocPtr HelpCompiler::getSourceDocument(const fs::path &filePath)
@@ -103,125 +107,79 @@ xmlDocPtr HelpCompiler::getSourceDocument(const fs::path &filePath)
     return res;
 }
 
-HashSet HelpCompiler::switchFind(xmlDocPtr doc)
-{
-    HashSet hs;
-    xmlChar *xpath = (xmlChar*)"//switchinline";
-
-    xmlXPathContextPtr context = xmlXPathNewContext(doc);
-    xmlXPathObjectPtr result = xmlXPathEvalExpression(xpath, context);
-    xmlXPathFreeContext(context);
-    if (result)
-    {
-        xmlNodeSetPtr nodeset = result->nodesetval;
-        for (int i = 0; i < nodeset->nodeNr; i++)
-        {
-            xmlNodePtr el = nodeset->nodeTab[i];
-            xmlChar *select = xmlGetProp(el, (xmlChar*)"select");
-            if (select)
-            {
-                if (!strcmp((const char*)select, "appl"))
-                {
-                    xmlNodePtr n1 = el->xmlChildrenNode;
-                    while (n1)
-                    {
-                        if ((!xmlStrcmp(n1->name, (const xmlChar*)"caseinline")))
-                        {
-                            xmlChar *appl = xmlGetProp(n1, (xmlChar*)"select");
-                            hs.push_back(std::string((const char*)appl));
-                            xmlFree(appl);
-                        }
-                        else if ((!xmlStrcmp(n1->name, (const xmlChar*)"defaultinline")))
-                            hs.push_back(std::string("DEFAULT"));
-                        n1 = n1->next;
-                    }
-                }
-                xmlFree(select);
-            }
-        }
-        xmlXPathFreeObject(result);
-    }
-    hs.push_back(std::string("DEFAULT"));
-    return hs;
-}
-
 // returns a node representing the whole stuff compiled for the current
 // application.
 xmlNodePtr HelpCompiler::clone(xmlNodePtr node, const std::string& appl)
 {
-    xmlNodePtr parent = xmlCopyNode(node, 2);
-    xmlNodePtr n = node->xmlChildrenNode;
-    while (n != NULL)
+    xmlNodePtr root = xmlCopyNode(node, 2);
+    if (node->xmlChildrenNode)
     {
-        bool isappl = false;
-        if ( (!strcmp((const char*)n->name, "switchinline")) ||
-             (!strcmp((const char*)n->name, "switch")) )
-        {
-            xmlChar *select = xmlGetProp(n, (xmlChar*)"select");
-            if (select)
-            {
-                if (!strcmp((const char*)select, "appl"))
-                    isappl = true;
-                xmlFree(select);
-            }
-        }
-        if (isappl)
+        xmlNodePtr list = node->xmlChildrenNode;
+        while (list)
         {
-            xmlNodePtr caseNode = n->xmlChildrenNode;
-            if (appl == "DEFAULT")
+            if (strcmp((const char*)list->name, "switchinline") == 0 || strcmp((const char*)list->name, "switch") == 0)
             {
-                while (caseNode)
+                std::string tmp="";
+                if (strcmp((const char*)xmlGetProp(list, (xmlChar*)"select"), "sys"))
                 {
-                    if (!strcmp((const char*)caseNode->name, "defaultinline"))
-                    {
-                        xmlNodePtr cnl = caseNode->xmlChildrenNode;
-                        while (cnl)
-                        {
-                            xmlAddChild(parent, clone(cnl, appl));
-                            cnl = cnl->next;
-                        }
-                        break;
-                    }
-                    caseNode = caseNode->next;
+                    tmp = gui;
                 }
-            }
-            else
-            {
-                while (caseNode)
+                if (strcmp((const char*)xmlGetProp(list, (xmlChar*)"select"), "appl"))
+                {
+                    tmp = appl;
+                }
+                if (tmp.compare("") != 0)
                 {
-                    isappl=false;
-                    if (!strcmp((const char*)caseNode->name, "caseinline"))
+                    bool isCase=false;
+                    xmlNodePtr caseList=list->xmlChildrenNode;
+                    while (caseList)
                     {
-                        xmlChar *select = xmlGetProp(n, (xmlChar*)"select");
+                        xmlChar *select = xmlGetProp(caseList, (xmlChar*)"select");
                         if (select)
                         {
-                            if (!strcmp((const char*)select, appl.c_str()))
-                                isappl = true;
+                            if (!strcmp((const char*)select, tmp.c_str()) && !isCase)
+                            {
+                                isCase=true;
+                                xmlNodePtr clp = caseList->xmlChildrenNode;
+                                while (clp)
+                                {
+                                    xmlAddChild(root, clone(clp, appl));
+                                    clp = clp->next;
+                                }
+                            }
                             xmlFree(select);
                         }
-                        if (isappl)
+                        else
                         {
-                            xmlNodePtr cnl = caseNode->xmlChildrenNode;
-                            while (cnl)
+                            if ((strcmp((const char*)caseList->name, "defaultinline") != 0) && (strcmp((const char*)caseList->name, "default") != 0))
+                            {
+                                xmlAddChild(root, clone(caseList, appl));
+                            }
+                            else
                             {
-                                xmlAddChild(parent, clone(cnl, appl));
-                                cnl = cnl->next;
+                                if (!isCase)
+                                {
+                                    xmlNodePtr clp = caseList->xmlChildrenNode;
+                                    while (clp)
+                                    {
+                                        xmlAddChild(root, clone(clp, appl));
+                                        clp = clp->next;
+                                    }
+                                }
                             }
-                            break;
                         }
-
+                        caseList = caseList->next;
                     }
-                    caseNode = caseNode->next;
                 }
             }
-
+            else
+            {
+                xmlAddChild(root, clone(list, appl));
+            }
+            list = list->next;
         }
-        else
-            xmlAddChild(parent, clone(n, appl));
-
-        n = n->next;
     }
-    return parent;
+    return root;
 }
 
 class myparser
@@ -246,6 +204,7 @@ public:
     }
     void traverse( xmlNodePtr parentNode );
 private:
+    std::string module;
     std::string dump(xmlNodePtr node);
 };
 
@@ -386,15 +345,13 @@ void myparser::traverse( xmlNodePtr parentNode )
             std::string name;
 
             HashSet::const_iterator aEnd = extendedHelpText.end();
-            for (HashSet::const_iterator iter = extendedHelpText.begin(); iter != aEnd;
-                ++iter)
+            for (HashSet::const_iterator iter = extendedHelpText.begin(); iter != aEnd; ++iter)
             {
                 name = *iter;
                 (*helptexts)[name] = text;
             }
             extendedHelpText.clear();
         }
-
         // traverse children
         traverse(test);
     }
@@ -409,6 +366,7 @@ bool HelpCompiler::compile( void ) throw( HelpProcessingException )
 
     // now add path to the document
     // resolve the dom
+
     if (!docResolvedOrg)
     {
         impl_sleep( 3 );
@@ -421,62 +379,38 @@ bool HelpCompiler::compile( void ) throw( HelpProcessingException )
         }
     }
 
-    // now find all applications for which one has to compile
     std::string documentId;
     std::string fileName;
     std::string title;
-    // returns all applications for which one has to compile
-    HashSet applications = switchFind(docResolvedOrg);
-
-    HashSet::const_iterator aEnd = applications.end();
-    for (HashSet::const_iterator aI = applications.begin(); aI != aEnd; ++aI)
+    // returns a clone of the document with switch-cases resolved
+    std::string appl = module.substr(1);
+    for (unsigned int i = 0; i < appl.length(); ++i)
     {
-        std::string appl = *aI;
-        std::string modulename = appl;
-        if (modulename[0] == 'S')
-        {
-            modulename = modulename.substr(1);
-            std::transform(modulename.begin(), modulename.end(), modulename.begin(), tocharlower);
-        }
-        if (modulename != "DEFAULT" && modulename != module)
-            continue;
-
-        // returns a clone of the document with swich-cases resolved
-        xmlNodePtr docResolved = clone(xmlDocGetRootElement(docResolvedOrg), appl);
-        myparser aparser(documentId, fileName, title);
-        aparser.traverse(docResolved);
-
-        documentId = aparser.documentId;
-        fileName = aparser.fileName;
-        title = aparser.title;
+        appl[i]=toupper(appl[i]);
+    }
+    xmlNodePtr docResolved = clone(xmlDocGetRootElement(docResolvedOrg), appl);
+    myparser aparser(documentId, fileName, title);
+    aparser.traverse(docResolved);
+    documentId = aparser.documentId;
+    fileName = aparser.fileName;
+    title = aparser.title;
 
-        HCDBG(std::cerr << documentId << " : " << fileName << " : " << title << std::endl);
+    HCDBG(std::cerr << documentId << " : " << fileName << " : " << title << std::endl);
 
-        xmlDocPtr docResolvedDoc = xmlCopyDoc(docResolvedOrg, false);
-        xmlDocSetRootElement(docResolvedDoc, docResolved);
+    xmlDocPtr docResolvedDoc = xmlCopyDoc(docResolvedOrg, false);
+    xmlDocSetRootElement(docResolvedDoc, docResolved);
 
-        if (modulename == "DEFAULT")
-        {
-            streamTable.dropdefault();
-            streamTable.default_doc = docResolvedDoc;
-            streamTable.default_hidlist = aparser.hidlist;
-            streamTable.default_helptexts = aparser.helptexts;
-            streamTable.default_keywords = aparser.keywords;
-        }
-        else
-        {
-            streamTable.dropappl();
-            streamTable.appl_doc = docResolvedDoc;
-            streamTable.appl_hidlist = aparser.hidlist;
-            streamTable.appl_helptexts = aparser.helptexts;
-            streamTable.appl_keywords = aparser.keywords;
-        }
-    } // end iteration over all applications
+    streamTable.dropappl();
+    streamTable.appl_doc = docResolvedDoc;
+    streamTable.appl_hidlist = aparser.hidlist;
+    streamTable.appl_helptexts = aparser.helptexts;
+    streamTable.appl_keywords = aparser.keywords;
 
     streamTable.document_id = documentId;
     streamTable.document_path = fileName;
     streamTable.document_title = title;
     std::string actMod = module;
+
     if ( !bExtensionMode && !fileName.empty())
     {
         if (fileName.find("/text/") == 0)
@@ -487,7 +421,6 @@ bool HelpCompiler::compile( void ) throw( HelpProcessingException )
         }
     }
     streamTable.document_module = actMod;
-
     xmlFreeDoc(docResolvedOrg);
     return true;
 }
diff --git a/l10ntools/source/help/HelpCompiler.hxx b/l10ntools/source/help/HelpCompiler.hxx
index cd83575..49ebd60 100644
--- a/l10ntools/source/help/HelpCompiler.hxx
+++ b/l10ntools/source/help/HelpCompiler.hxx
@@ -256,13 +256,13 @@ public:
                 const std::string &entryName, const Hashtable &bytesToAdd);
 private:
     xmlDocPtr getSourceDocument(const fs::path &filePath);
-    HashSet switchFind(xmlDocPtr doc);
     xmlNodePtr clone(xmlNodePtr node, const std::string& appl);
     StreamTable &streamTable;
     const fs::path inputFile, src;
     const std::string module, lang;
     const fs::path resEmbStylesheet;
     bool bExtensionMode;
+    std::string gui;
 };
 
 inline char tocharlower(char c)


More information about the Libreoffice-commits mailing list