This is an automated email from the ASF dual-hosted git repository. mseidel pushed a commit to branch AOO42X in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/AOO42X by this push: new 45e4e2b01d Fixed typos, cleanup 45e4e2b01d is described below commit 45e4e2b01db2c233bee37896baa4c45c84609d67 Author: mseidel <msei...@apache.org> AuthorDate: Mon Apr 7 17:38:37 2025 +0200 Fixed typos, cleanup (cherry picked from commit f3eb8045b8bfa36be412cd01586152fc987fc7d8) --- main/sw/inc/docstat.hxx | 18 +- main/sw/source/core/inc/UndoSection.hxx | 54 ++- main/sw/source/core/inc/notxtfrm.hxx | 29 +- main/sw/source/core/layout/virtoutp.hxx | 21 +- main/sw/source/filter/ww8/docxfootnotes.hxx | 102 ++--- main/sw/source/filter/xml/wrtxml.hxx | 38 +- main/sw/source/ui/docvw/SidebarTxtControl.cxx | 579 +++++++++++++------------- 7 files changed, 419 insertions(+), 422 deletions(-) diff --git a/main/sw/inc/docstat.hxx b/main/sw/inc/docstat.hxx index 09969e3120..699a579d05 100644 --- a/main/sw/inc/docstat.hxx +++ b/main/sw/inc/docstat.hxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,36 +7,34 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ - #ifndef _DOCSTAT_HXX #define _DOCSTAT_HXX #include <tools/solar.h> #include "swdllapi.h" - struct SW_DLLPUBLIC SwDocStat { sal_uInt16 nTbl; sal_uInt16 nGrf; sal_uInt16 nOLE; sal_uLong nPage; - /// paragraphs for document statistic: non-empty and non-hidden ones + // paragraphs for document statistic: non-empty and non-hidden ones sal_uLong nPara; - /// all paragraphs, including empty/hidden ones - sal_uLong nAllPara; + // all paragraphs, including empty/hidden ones + sal_uLong nAllPara; sal_uLong nWord; sal_uLong nChar; sal_Bool bModified; @@ -46,3 +44,5 @@ struct SW_DLLPUBLIC SwDocStat }; #endif + +/* vim: set noet sw=4 ts=4: */ diff --git a/main/sw/source/core/inc/UndoSection.hxx b/main/sw/source/core/inc/UndoSection.hxx index 1cd5f5f103..f9a3b98b20 100644 --- a/main/sw/source/core/inc/UndoSection.hxx +++ b/main/sw/source/core/inc/UndoSection.hxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,20 +7,18 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ - - #ifndef SW_UNDO_SECTION_HXX #define SW_UNDO_SECTION_HXX @@ -30,44 +28,42 @@ #include <swdllapi.h> - class SfxItemSet; class SwTxtNode; class SwSectionData; class SwSectionFmt; class SwTOXBase; - //------------ Undo of Insert-/Delete-Section ---------------------- class SwUndoInsSection : public SwUndo, private SwUndRng { private: - const ::std::auto_ptr<SwSectionData> m_pSectionData; - const ::std::auto_ptr<SwTOXBase> m_pTOXBase; /// set iff section is TOX - const ::std::auto_ptr<SfxItemSet> m_pAttrSet; - ::std::auto_ptr<SwHistory> m_pHistory; - ::std::auto_ptr<SwRedlineData> m_pRedlData; - sal_uLong m_nSectionNodePos; - bool m_bSplitAtStart : 1; - bool m_bSplitAtEnd : 1; - bool m_bUpdateFtn : 1; - - void Join( SwDoc& rDoc, sal_uLong nNode ); + const ::std::auto_ptr<SwSectionData> m_pSectionData; + const ::std::auto_ptr<SwTOXBase> m_pTOXBase; // set iff section is TOX + const ::std::auto_ptr<SfxItemSet> m_pAttrSet; + ::std::auto_ptr<SwHistory> m_pHistory; + ::std::auto_ptr<SwRedlineData> m_pRedlData; + sal_uLong m_nSectionNodePos; + bool m_bSplitAtStart : 1; + bool m_bSplitAtEnd : 1; + bool m_bUpdateFtn : 1; + + void Join( SwDoc& rDoc, sal_uLong nNode ); public: - SwUndoInsSection(SwPaM const&, SwSectionData const&, - SfxItemSet const*const pSet, SwTOXBase const*const pTOXBase); + SwUndoInsSection(SwPaM const&, SwSectionData const&, + SfxItemSet const*const pSet, SwTOXBase const*const pTOXBase); - virtual ~SwUndoInsSection(); + virtual ~SwUndoInsSection(); - virtual void UndoImpl( ::sw::UndoRedoContext & ); - virtual void RedoImpl( ::sw::UndoRedoContext & ); - virtual void RepeatImpl( ::sw::RepeatContext & ); + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + virtual void RepeatImpl( ::sw::RepeatContext & ); - void SetSectNdPos(sal_uLong const nPos) { m_nSectionNodePos = nPos; } - void SaveSplitNode(SwTxtNode *const pTxtNd, bool const bAtStart); - void SetUpdtFtnFlag(bool const bFlag) { m_bUpdateFtn = bFlag; } + void SetSectNdPos(sal_uLong const nPos) { m_nSectionNodePos = nPos; } + void SaveSplitNode(SwTxtNode *const pTxtNd, bool const bAtStart); + void SetUpdtFtnFlag(bool const bFlag) { m_bUpdateFtn = bFlag; } }; SW_DLLPRIVATE SwUndo * MakeUndoDelSection(SwSectionFmt const&); @@ -75,3 +71,5 @@ SW_DLLPRIVATE SwUndo * MakeUndoDelSection(SwSectionFmt const&); SW_DLLPRIVATE SwUndo * MakeUndoUpdateSection(SwSectionFmt const&, bool const); #endif // SW_UNDO_SECTION_HXX + +/* vim: set noet sw=4 ts=4: */ diff --git a/main/sw/source/core/inc/notxtfrm.hxx b/main/sw/source/core/inc/notxtfrm.hxx index 9580b6eafb..231b1a7aac 100644 --- a/main/sw/source/core/inc/notxtfrm.hxx +++ b/main/sw/source/core/inc/notxtfrm.hxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,19 +7,18 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ - #ifndef SW_NOTXTFRM_HXX #define SW_NOTXTFRM_HXX @@ -33,18 +32,18 @@ struct SwCrsrMoveState; class SwNoTxtFrm: public SwCntntFrm { - friend void _FrmFinit(); + friend void _FrmFinit(); - short nWeight; // "Wichtigkeit" der Grafik + short nWeight; // "Wichtigkeit" der Grafik const Size& GetSize() const; void InitCtor(); void Format ( const SwBorderAttrs *pAttrs = 0 ); - void PaintCntnt ( OutputDevice*, const SwRect&, const SwRect& ) const; - /// OD 25.09.2002 #99739# - delete unused 3rd parameter - void PaintPicture( OutputDevice*, const SwRect& ) const; + void PaintCntnt ( OutputDevice*, const SwRect&, const SwRect& ) const; + // OD 25.09.2002 #99739# - delete unused 3rd parameter + void PaintPicture( OutputDevice*, const SwRect& ) const; protected: virtual void MakeAll(); virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ); @@ -52,12 +51,12 @@ public: SwNoTxtFrm( SwNoTxtNode * const, SwFrm* ); ~SwNoTxtFrm(); - virtual void Paint( SwRect const&, - SwPrintData const*const pPrintData = NULL ) const; + virtual void Paint( SwRect const&, + SwPrintData const*const pPrintData = NULL ) const; virtual sal_Bool GetCharRect( SwRect &, const SwPosition&, SwCrsrMoveState* = 0) const; sal_Bool GetCrsrOfst(SwPosition* pPos, Point& aPoint, - SwCrsrMoveState* = 0) const; + SwCrsrMoveState* = 0) const; const Size &GetGrfSize() const { return GetSize(); } void GetGrfArea( SwRect &rRect, SwRect * = 0, sal_Bool bMirror = sal_True ) const; @@ -65,10 +64,12 @@ public: sal_Bool IsTransparent() const; void StopAnimation( OutputDevice* = 0 ) const; - sal_Bool HasAnimation() const; + sal_Bool HasAnimation() const; // Routinen fuer den Grafik-Cache sal_uInt16 GetWeight() { return nWeight; } }; #endif + +/* vim: set noet sw=4 ts=4: */ diff --git a/main/sw/source/core/layout/virtoutp.hxx b/main/sw/source/core/layout/virtoutp.hxx index 15f5e4351b..c9e93071b3 100644 --- a/main/sw/source/core/layout/virtoutp.hxx +++ b/main/sw/source/core/layout/virtoutp.hxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,19 +7,18 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ - #ifndef _VIRTOUTP_HXX #define _VIRTOUTP_HXX @@ -32,7 +31,7 @@ class ViewShell; #define VIRTUALHEIGHT 64 /************************************************************************* - * class SwTxtVout + * class SwTxtVout *************************************************************************/ class SwLayVout @@ -50,11 +49,11 @@ private: sal_Bool DoesFit( const Size &rOut ); public: - SwLayVout() : pSh(0), pOut(0), pVirDev(0), aSize(0, VIRTUALHEIGHT), nCount(0) {} + SwLayVout() : pSh(0), pOut(0), pVirDev(0), aSize(0, VIRTUALHEIGHT), nCount(0) {} ~SwLayVout() { delete pVirDev; } - /// OD 27.09.2002 #103636# - change 2nd parameter <rRect> - no longer <const> - void Enter( ViewShell *pShell, SwRect &rRect, sal_Bool bOn ); + // OD 27.09.2002 #103636# - change 2nd parameter <rRect> - no longer <const> + void Enter( ViewShell *pShell, SwRect &rRect, sal_Bool bOn ); void Leave() { --nCount; Flush(); } void SetOrgRect( SwRect &rRect ) { aOrgRect = rRect; } @@ -65,6 +64,6 @@ public: void Flush() { if( pOut ) _Flush(); } }; - - #endif + +/* vim: set noet sw=4 ts=4: */ diff --git a/main/sw/source/filter/ww8/docxfootnotes.hxx b/main/sw/source/filter/ww8/docxfootnotes.hxx index 27d62a7064..f34cdb5370 100644 --- a/main/sw/source/filter/ww8/docxfootnotes.hxx +++ b/main/sw/source/filter/ww8/docxfootnotes.hxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,20 +7,18 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ - - #ifndef _DOCXFOOTNOTES_HXX_ #define _DOCXFOOTNOTES_HXX_ @@ -38,58 +36,60 @@ typedef ::std::vector< const SwFmtFtn* > FootnotesVector; /** Remember footnotes/endnotes so that we can dump them in one go. - Also rememeber the last added footnote Id to be able to write it in the - DocxAttributeOutput::EndRunProperties() method. + Also remember the last added footnote Id to be able to write it in the + DocxAttributeOutput::EndRunProperties() method. */ class FootnotesList { - /// The current footnote, that was not written yet. - sal_Int32 m_nCurrent; + // The current footnote, that was not written yet. + sal_Int32 m_nCurrent; - /// List of the footnotes. - FootnotesVector m_aFootnotes; + // List of the footnotes. + FootnotesVector m_aFootnotes; public: - FootnotesList() : m_nCurrent( -1 ) {} - - void add( const SwFmtFtn& rFootnote ) - { - m_aFootnotes.push_back( &rFootnote ); - m_nCurrent = m_aFootnotes.size() - 1; - } - - /// Return the current footnote/endnote and clear the 'current' state. - const SwFmtFtn* getCurrent( sal_Int32& rId ) - { - // skip ids 0 and 1 - they are reserved for separator and - // continuationSeparator - rId = m_nCurrent + 2; - - // anything to write at all? - if ( m_nCurrent < 0 ) - { - rId = -1; - return NULL; - } - - const SwFmtFtn *pFootnote = m_aFootnotes[m_nCurrent]; - m_nCurrent = -1; - - return pFootnote; - } - - /// Return all the footnotes/endnotes. - const FootnotesVector& getVector() const - { - return m_aFootnotes; - } - - /// Do we have any footnotes/endnotes at all? - bool isEmpty() const - { - return m_aFootnotes.empty(); - } + FootnotesList() : m_nCurrent( -1 ) {} + + void add( const SwFmtFtn& rFootnote ) + { + m_aFootnotes.push_back( &rFootnote ); + m_nCurrent = m_aFootnotes.size() - 1; + } + + // Return the current footnote/endnote and clear the 'current' state. + const SwFmtFtn* getCurrent( sal_Int32& rId ) + { + // skip ids 0 and 1 - they are reserved for separator and + // continuationSeparator + rId = m_nCurrent + 2; + + // anything to write at all? + if ( m_nCurrent < 0 ) + { + rId = -1; + return NULL; + } + + const SwFmtFtn *pFootnote = m_aFootnotes[m_nCurrent]; + m_nCurrent = -1; + + return pFootnote; + } + + // Return all the footnotes/endnotes. + const FootnotesVector& getVector() const + { + return m_aFootnotes; + } + + // Do we have any footnotes/endnotes at all? + bool isEmpty() const + { + return m_aFootnotes.empty(); + } }; } // namespace docx #endif // _DOCXFOOTNOTES_HXX_ + +/* vim: set noet sw=4 ts=4: */ diff --git a/main/sw/source/filter/xml/wrtxml.hxx b/main/sw/source/filter/xml/wrtxml.hxx index 4b9228f9c1..48674c6abb 100644 --- a/main/sw/source/filter/xml/wrtxml.hxx +++ b/main/sw/source/filter/xml/wrtxml.hxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,19 +7,18 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ - #ifndef _WRTXML_HXX #define _WRTXML_HXX @@ -43,9 +42,9 @@ namespace com { namespace sun { namespace star { class SwXMLWriter : public StgWriter { - sal_uInt32 _Write( const com::sun::star::uno::Reference < com::sun::star::task::XStatusIndicator>&, const rtl::OUString& ); + sal_uInt32 _Write( const com::sun::star::uno::Reference < com::sun::star::task::XStatusIndicator>&, const rtl::OUString& ); - using StgWriter::Write; + using StgWriter::Write; protected: virtual sal_uLong WriteStorage(); @@ -53,7 +52,7 @@ protected: public: - SwXMLWriter( const String& rBaseURL ); + SwXMLWriter( const String& rBaseURL ); virtual ~SwXMLWriter(); virtual sal_uLong Write( SwPaM&, SfxMedium&, const String* = 0 ); @@ -62,26 +61,26 @@ private: // helper methods to write XML streams - /// write a single XML stream into the package + // write a single XML stream into the package sal_Bool WriteThroughComponent( - /// the component we export + // the component we export const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent> & xComponent, - const sal_Char* pStreamName, /// the stream name - /// service factory for pServiceName + const sal_Char* pStreamName, // the stream name + // service factory for pServiceName const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> & rFactory, - const sal_Char* pServiceName, /// service name of the component - /// the argument (XInitialization) + const sal_Char* pServiceName, // service name of the component + // the argument (XInitialization) const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any> & rArguments, - /// output descriptor + // output descriptor const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> & rMediaDesc, - sal_Bool bPlainStream ); /// neither compress nor encrypt + sal_Bool bPlainStream ); // neither compress nor encrypt - /// write a single output stream - /// (to be called either directly or by WriteThroughComponent(...)) + // write a single output stream + // (to be called either directly or by WriteThroughComponent(...)) sal_Bool WriteThroughComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream> & xOutputStream, @@ -96,5 +95,6 @@ private: ::com::sun::star::beans::PropertyValue> & rMediaDesc ); }; +#endif // _WRTXML_HXX -#endif // _WRTXML_HXX +/* vim: set noet sw=4 ts=4: */ diff --git a/main/sw/source/ui/docvw/SidebarTxtControl.cxx b/main/sw/source/ui/docvw/SidebarTxtControl.cxx index 20ef97cbc8..b66be56c8e 100644 --- a/main/sw/source/ui/docvw/SidebarTxtControl.cxx +++ b/main/sw/source/ui/docvw/SidebarTxtControl.cxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,21 +7,18 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ - - - #include "precompiled_sw.hxx" #include <SidebarTxtControl.hxx> @@ -63,357 +60,359 @@ namespace css = ::com::sun::star; namespace sw { namespace sidebarwindows { SidebarTxtControl::SidebarTxtControl( SwSidebarWin& rSidebarWin, - WinBits nBits, - SwView& rDocView, - SwPostItMgr& rPostItMgr ) - : Control( &rSidebarWin, nBits ) - , mrSidebarWin( rSidebarWin ) - , mrDocView( rDocView ) - , mrPostItMgr( rPostItMgr ) - , mbMouseOver( false ) + WinBits nBits, + SwView& rDocView, + SwPostItMgr& rPostItMgr ) + : Control( &rSidebarWin, nBits ) + , mrSidebarWin( rSidebarWin ) + , mrDocView( rDocView ) + , mrPostItMgr( rPostItMgr ) + , mbMouseOver( false ) { - AddEventListener( LINK( &mrSidebarWin, SwSidebarWin, WindowEventListener ) ); + AddEventListener( LINK( &mrSidebarWin, SwSidebarWin, WindowEventListener ) ); } SidebarTxtControl::~SidebarTxtControl() { - RemoveEventListener( LINK( &mrSidebarWin, SwSidebarWin, WindowEventListener ) ); + RemoveEventListener( LINK( &mrSidebarWin, SwSidebarWin, WindowEventListener ) ); } OutlinerView* SidebarTxtControl::GetTextView() const { - return mrSidebarWin.GetOutlinerView(); + return mrSidebarWin.GetOutlinerView(); } void SidebarTxtControl::GetFocus() { - Window::GetFocus(); - if ( !mrSidebarWin.IsMouseOver() ) - { - Invalidate(); - } + Window::GetFocus(); + if ( !mrSidebarWin.IsMouseOver() ) + { + Invalidate(); + } } void SidebarTxtControl::LoseFocus() { - // write the visible text back into the SwField - mrSidebarWin.UpdateData(); - - Window::LoseFocus(); - if ( !mrSidebarWin.IsMouseOver() ) - { - Invalidate(); - } + // write the visible text back into the SwField + mrSidebarWin.UpdateData(); + + Window::LoseFocus(); + if ( !mrSidebarWin.IsMouseOver() ) + { + Invalidate(); + } } void SidebarTxtControl::RequestHelp(const HelpEvent &rEvt) { - sal_uInt16 nResId = 0; - switch( mrSidebarWin.GetLayoutStatus() ) - { - case SwPostItHelper::INSERTED: nResId = STR_REDLINE_INSERT; break; - case SwPostItHelper::DELETED: nResId = STR_REDLINE_DELETE; break; - default: nResId = 0; - } - - SwContentAtPos aCntntAtPos( SwContentAtPos::SW_REDLINE ); - if ( nResId && - mrDocView.GetWrtShell().GetContentAtPos( mrSidebarWin.GetAnchorPos(), aCntntAtPos ) ) - { - String sTxt; - sTxt = SW_RESSTR( nResId ); - sTxt.AppendAscii( RTL_CONSTASCII_STRINGPARAM(": " )); - sTxt += aCntntAtPos.aFnd.pRedl->GetAuthorString(); - sTxt.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " - " )); - sTxt += GetAppLangDateTimeString( aCntntAtPos.aFnd.pRedl->GetTimeStamp() ); - Help::ShowQuickHelp( this,PixelToLogic(Rectangle(rEvt.GetMousePosPixel(),Size(50,10))),sTxt); - } + sal_uInt16 nResId = 0; + switch( mrSidebarWin.GetLayoutStatus() ) + { + case SwPostItHelper::INSERTED: nResId = STR_REDLINE_INSERT; break; + case SwPostItHelper::DELETED: nResId = STR_REDLINE_DELETE; break; + default: nResId = 0; + } + + SwContentAtPos aCntntAtPos( SwContentAtPos::SW_REDLINE ); + if ( nResId && + mrDocView.GetWrtShell().GetContentAtPos( mrSidebarWin.GetAnchorPos(), aCntntAtPos ) ) + { + String sTxt; + sTxt = SW_RESSTR( nResId ); + sTxt.AppendAscii( RTL_CONSTASCII_STRINGPARAM(": " )); + sTxt += aCntntAtPos.aFnd.pRedl->GetAuthorString(); + sTxt.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " - " )); + sTxt += GetAppLangDateTimeString( aCntntAtPos.aFnd.pRedl->GetTimeStamp() ); + Help::ShowQuickHelp( this,PixelToLogic(Rectangle(rEvt.GetMousePosPixel(),Size(50,10))),sTxt); + } } void SidebarTxtControl::Paint( const Rectangle& rRect) { - if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() ) - { - if ( mrSidebarWin.IsMouseOverSidebarWin() || - HasFocus() ) - { - DrawGradient( Rectangle( Point(0,0), PixelToLogic(GetSizePixel()) ), - Gradient( GRADIENT_LINEAR, - mrSidebarWin.ColorDark(), - mrSidebarWin.ColorDark() ) ); - } - else - { - DrawGradient( Rectangle( Point(0,0), PixelToLogic(GetSizePixel()) ), - Gradient( GRADIENT_LINEAR, - mrSidebarWin.ColorLight(), - mrSidebarWin.ColorDark())); - } - } - - if ( GetTextView() ) - { - GetTextView()->Paint( rRect ); - } - - if ( mrSidebarWin.GetLayoutStatus()==SwPostItHelper::DELETED ) - { - SetLineColor(mrSidebarWin.GetChangeColor()); - DrawLine( PixelToLogic( GetPosPixel() ), - PixelToLogic( GetPosPixel() + - Point( GetSizePixel().Width(), - GetSizePixel().Height() ) ) ); - DrawLine( PixelToLogic( GetPosPixel() + - Point( GetSizePixel().Width(),0) ), - PixelToLogic( GetPosPixel() + - Point( 0, GetSizePixel().Height() ) ) ); - } + if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() ) + { + if ( mrSidebarWin.IsMouseOverSidebarWin() || + HasFocus() ) + { + DrawGradient( Rectangle( Point(0,0), PixelToLogic(GetSizePixel()) ), + Gradient( GRADIENT_LINEAR, + mrSidebarWin.ColorDark(), + mrSidebarWin.ColorDark() ) ); + } + else + { + DrawGradient( Rectangle( Point(0,0), PixelToLogic(GetSizePixel()) ), + Gradient( GRADIENT_LINEAR, + mrSidebarWin.ColorLight(), + mrSidebarWin.ColorDark())); + } + } + + if ( GetTextView() ) + { + GetTextView()->Paint( rRect ); + } + + if ( mrSidebarWin.GetLayoutStatus()==SwPostItHelper::DELETED ) + { + SetLineColor(mrSidebarWin.GetChangeColor()); + DrawLine( PixelToLogic( GetPosPixel() ), + PixelToLogic( GetPosPixel() + + Point( GetSizePixel().Width(), + GetSizePixel().Height() ) ) ); + DrawLine( PixelToLogic( GetPosPixel() + + Point( GetSizePixel().Width(),0) ), + PixelToLogic( GetPosPixel() + + Point( 0, GetSizePixel().Height() ) ) ); + } } void SidebarTxtControl::KeyInput( const KeyEvent& rKeyEvt ) { - const KeyCode& rKeyCode = rKeyEvt.GetKeyCode(); - sal_uInt16 nKey = rKeyCode.GetCode(); - if ( ( rKeyCode.IsMod1() && rKeyCode.IsMod2() ) && - ( (nKey == KEY_PAGEUP) || (nKey == KEY_PAGEDOWN) ) ) - { - mrSidebarWin.SwitchToPostIt(nKey); - } - else if ( nKey == KEY_ESCAPE || - ( rKeyCode.IsMod1() && - ( nKey == KEY_PAGEUP || - nKey == KEY_PAGEDOWN ) ) ) - { - mrSidebarWin.SwitchToFieldPos(); - } - else if ( nKey == KEY_INSERT ) - { - if ( !rKeyCode.IsMod1() && !rKeyCode.IsMod2() ) - { - mrSidebarWin.ToggleInsMode(); - } - } - else - { - //let's make sure we see our note - mrPostItMgr.MakeVisible(&mrSidebarWin); - - long aOldHeight = mrSidebarWin.GetPostItTextHeight(); - bool bDone = false; - - /// HACK: need to switch off processing of Undo/Redo in Outliner - if ( !( (nKey == KEY_Z || nKey == KEY_Y) && rKeyCode.IsMod1()) ) - { - bool bIsProtected = mrSidebarWin.IsProtected(); - if ( !bIsProtected || - ( bIsProtected && - !mrSidebarWin.GetOutlinerView()->GetOutliner()->GetEditEngine().DoesKeyChangeText(rKeyEvt)) ) - { - bDone = GetTextView() && GetTextView()->PostKeyEvent( rKeyEvt ); - } - else - { - InfoBox( this, SW_RES( MSG_READONLY_CONTENT )).Execute(); - } - } - if (bDone) - mrSidebarWin.ResizeIfNeccessary( aOldHeight, mrSidebarWin.GetPostItTextHeight() ); - else - { - // write back data first when showing navigator - if ( nKey==KEY_F5 ) - mrSidebarWin.UpdateData(); - if (!mrDocView.KeyInput(rKeyEvt)) - Window::KeyInput(rKeyEvt); - } - } - - mrDocView.GetViewFrame()->GetBindings().InvalidateAll(sal_False); + const KeyCode& rKeyCode = rKeyEvt.GetKeyCode(); + sal_uInt16 nKey = rKeyCode.GetCode(); + if ( ( rKeyCode.IsMod1() && rKeyCode.IsMod2() ) && + ( (nKey == KEY_PAGEUP) || (nKey == KEY_PAGEDOWN) ) ) + { + mrSidebarWin.SwitchToPostIt(nKey); + } + else if ( nKey == KEY_ESCAPE || + ( rKeyCode.IsMod1() && + ( nKey == KEY_PAGEUP || + nKey == KEY_PAGEDOWN ) ) ) + { + mrSidebarWin.SwitchToFieldPos(); + } + else if ( nKey == KEY_INSERT ) + { + if ( !rKeyCode.IsMod1() && !rKeyCode.IsMod2() ) + { + mrSidebarWin.ToggleInsMode(); + } + } + else + { + // let's make sure we see our note + mrPostItMgr.MakeVisible(&mrSidebarWin); + + long aOldHeight = mrSidebarWin.GetPostItTextHeight(); + bool bDone = false; + + // HACK: need to switch off processing of Undo/Redo in Outliner + if ( !( (nKey == KEY_Z || nKey == KEY_Y) && rKeyCode.IsMod1()) ) + { + bool bIsProtected = mrSidebarWin.IsProtected(); + if ( !bIsProtected || + ( bIsProtected && + !mrSidebarWin.GetOutlinerView()->GetOutliner()->GetEditEngine().DoesKeyChangeText(rKeyEvt)) ) + { + bDone = GetTextView() && GetTextView()->PostKeyEvent( rKeyEvt ); + } + else + { + InfoBox( this, SW_RES( MSG_READONLY_CONTENT )).Execute(); + } + } + if (bDone) + mrSidebarWin.ResizeIfNeccessary( aOldHeight, mrSidebarWin.GetPostItTextHeight() ); + else + { + // write back data first when showing navigator + if ( nKey==KEY_F5 ) + mrSidebarWin.UpdateData(); + if (!mrDocView.KeyInput(rKeyEvt)) + Window::KeyInput(rKeyEvt); + } + } + + mrDocView.GetViewFrame()->GetBindings().InvalidateAll(sal_False); } void SidebarTxtControl::MouseMove( const MouseEvent& rMEvt ) { - if ( GetTextView() ) - { - OutlinerView* pOutlinerView( GetTextView() ); - pOutlinerView->MouseMove( rMEvt ); - // mba: why does OutlinerView not handle the modifier setting?! - // this forces the postit to handle *all* pointer types - SetPointer( pOutlinerView->GetPointer( rMEvt.GetPosPixel() ) ); - - const EditView& aEV = pOutlinerView->GetEditView(); - const SvxFieldItem* pItem = aEV.GetFieldUnderMousePointer(); - if ( pItem ) - { - const SvxFieldData* pFld = pItem->GetField(); - const SvxURLField* pURL = PTR_CAST( SvxURLField, pFld ); - if ( pURL ) - { - String sURL( pURL->GetURL() ); - SvtSecurityOptions aSecOpts; - if ( aSecOpts.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK) ) - { - sURL.InsertAscii( ": ", 0 ); - sURL.Insert( ViewShell::GetShellRes()->aHyperlinkClick, 0 ); - } - Help::ShowQuickHelp( this,PixelToLogic(Rectangle(GetPosPixel(),Size(50,10))),sURL); - } - } - } + if ( GetTextView() ) + { + OutlinerView* pOutlinerView( GetTextView() ); + pOutlinerView->MouseMove( rMEvt ); + // mba: why does OutlinerView not handle the modifier setting?! + // this forces the postit to handle *all* pointer types + SetPointer( pOutlinerView->GetPointer( rMEvt.GetPosPixel() ) ); + + const EditView& aEV = pOutlinerView->GetEditView(); + const SvxFieldItem* pItem = aEV.GetFieldUnderMousePointer(); + if ( pItem ) + { + const SvxFieldData* pFld = pItem->GetField(); + const SvxURLField* pURL = PTR_CAST( SvxURLField, pFld ); + if ( pURL ) + { + String sURL( pURL->GetURL() ); + SvtSecurityOptions aSecOpts; + if ( aSecOpts.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK) ) + { + sURL.InsertAscii( ": ", 0 ); + sURL.Insert( ViewShell::GetShellRes()->aHyperlinkClick, 0 ); + } + Help::ShowQuickHelp( this,PixelToLogic(Rectangle(GetPosPixel(),Size(50,10))),sURL); + } + } + } } void SidebarTxtControl::MouseButtonDown( const MouseEvent& rMEvt ) { - if ( GetTextView() ) - { - SvtSecurityOptions aSecOpts; - bool bExecuteMod = aSecOpts.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK); - - if ( !bExecuteMod || (bExecuteMod && rMEvt.GetModifier() == KEY_MOD1)) - { - const EditView& aEV = GetTextView()->GetEditView(); - const SvxFieldItem* pItem = aEV.GetFieldUnderMousePointer(); - if ( pItem ) - { - const SvxFieldData* pFld = pItem->GetField(); - const SvxURLField* pURL = PTR_CAST( SvxURLField, pFld ); - if ( pURL ) - { - GetTextView()->MouseButtonDown( rMEvt ); - SwWrtShell &rSh = mrDocView.GetWrtShell(); - String sURL( pURL->GetURL() ); - String sTarget( pURL->GetTargetFrame() ); - ::LoadURL( sURL, &rSh, URLLOAD_NOFILTER, &sTarget); - return; - } - } - } - } - - GrabFocus(); - if ( GetTextView() ) - { - GetTextView()->MouseButtonDown( rMEvt ); - } - mrDocView.GetViewFrame()->GetBindings().InvalidateAll(sal_False); + if ( GetTextView() ) + { + SvtSecurityOptions aSecOpts; + bool bExecuteMod = aSecOpts.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK); + + if ( !bExecuteMod || (bExecuteMod && rMEvt.GetModifier() == KEY_MOD1)) + { + const EditView& aEV = GetTextView()->GetEditView(); + const SvxFieldItem* pItem = aEV.GetFieldUnderMousePointer(); + if ( pItem ) + { + const SvxFieldData* pFld = pItem->GetField(); + const SvxURLField* pURL = PTR_CAST( SvxURLField, pFld ); + if ( pURL ) + { + GetTextView()->MouseButtonDown( rMEvt ); + SwWrtShell &rSh = mrDocView.GetWrtShell(); + String sURL( pURL->GetURL() ); + String sTarget( pURL->GetTargetFrame() ); + ::LoadURL( sURL, &rSh, URLLOAD_NOFILTER, &sTarget); + return; + } + } + } + } + + GrabFocus(); + if ( GetTextView() ) + { + GetTextView()->MouseButtonDown( rMEvt ); + } + mrDocView.GetViewFrame()->GetBindings().InvalidateAll(sal_False); } void SidebarTxtControl::MouseButtonUp( const MouseEvent& rMEvt ) { - if ( GetTextView() ) - GetTextView()->MouseButtonUp( rMEvt ); + if ( GetTextView() ) + GetTextView()->MouseButtonUp( rMEvt ); } IMPL_LINK( SidebarTxtControl, OnlineSpellCallback, SpellCallbackInfo*, pInfo ) { - if ( pInfo->nCommand == SPELLCMD_STARTSPELLDLG ) - { - mrDocView.GetViewFrame()->GetDispatcher()->Execute( FN_SPELL_GRAMMAR_DIALOG, SFX_CALLMODE_ASYNCHRON); - } - return 0; + if ( pInfo->nCommand == SPELLCMD_STARTSPELLDLG ) + { + mrDocView.GetViewFrame()->GetDispatcher()->Execute( FN_SPELL_GRAMMAR_DIALOG, SFX_CALLMODE_ASYNCHRON); + } + return 0; } IMPL_LINK( SidebarTxtControl, Select, Menu*, pSelMenu ) { - mrSidebarWin.ExecuteCommand( pSelMenu->GetCurItemId() ); - return 0; + mrSidebarWin.ExecuteCommand( pSelMenu->GetCurItemId() ); + return 0; } void SidebarTxtControl::Command( const CommandEvent& rCEvt ) { - if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU ) - { - if ( !mrSidebarWin.IsProtected() && - GetTextView() && - GetTextView()->IsWrongSpelledWordAtPos( rCEvt.GetMousePosPixel(),sal_True )) - { - Link aLink = LINK(this, SidebarTxtControl, OnlineSpellCallback); - GetTextView()->ExecuteSpellPopup(rCEvt.GetMousePosPixel(),&aLink); - } - else - { - SfxPopupMenuManager* pMgr = mrDocView.GetViewFrame()->GetDispatcher()->Popup(0, this,&rCEvt.GetMousePosPixel()); - ((PopupMenu*)pMgr->GetSVMenu())->SetSelectHdl( LINK(this, SidebarTxtControl, Select) ); - - { - XubString aText = ((PopupMenu*)pMgr->GetSVMenu())->GetItemText( FN_DELETE_NOTE_AUTHOR ); - SwRewriter aRewriter; - aRewriter.AddRule(UNDO_ARG1, mrSidebarWin.GetAuthor()); - aText = aRewriter.Apply(aText); - ((PopupMenu*)pMgr->GetSVMenu())->SetItemText(FN_DELETE_NOTE_AUTHOR,aText); - } - - Point aPos; - if (rCEvt.IsMouseEvent()) - aPos = rCEvt.GetMousePosPixel(); - else - { - const Size aSize = GetSizePixel(); - aPos = Point( aSize.getWidth()/2, aSize.getHeight()/2 ); - } - - //!! call different Execute function to get rid of the new thesaurus sub menu - //!! pointer created in the call to Popup. - //!! Otherwise we would have a memory leak (see also #i107205#) - //((PopupMenu*)pMgr->GetSVMenu())->Execute( this, aPos ); - pMgr->Execute( aPos, this ); + if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU ) + { + if ( !mrSidebarWin.IsProtected() && + GetTextView() && + GetTextView()->IsWrongSpelledWordAtPos( rCEvt.GetMousePosPixel(),sal_True )) + { + Link aLink = LINK(this, SidebarTxtControl, OnlineSpellCallback); + GetTextView()->ExecuteSpellPopup(rCEvt.GetMousePosPixel(),&aLink); + } + else + { + SfxPopupMenuManager* pMgr = mrDocView.GetViewFrame()->GetDispatcher()->Popup(0, this,&rCEvt.GetMousePosPixel()); + ((PopupMenu*)pMgr->GetSVMenu())->SetSelectHdl( LINK(this, SidebarTxtControl, Select) ); + + { + XubString aText = ((PopupMenu*)pMgr->GetSVMenu())->GetItemText( FN_DELETE_NOTE_AUTHOR ); + SwRewriter aRewriter; + aRewriter.AddRule(UNDO_ARG1, mrSidebarWin.GetAuthor()); + aText = aRewriter.Apply(aText); + ((PopupMenu*)pMgr->GetSVMenu())->SetItemText(FN_DELETE_NOTE_AUTHOR,aText); + } + + Point aPos; + if (rCEvt.IsMouseEvent()) + aPos = rCEvt.GetMousePosPixel(); + else + { + const Size aSize = GetSizePixel(); + aPos = Point( aSize.getWidth()/2, aSize.getHeight()/2 ); + } + + //!! call different Execute function to get rid of the new thesaurus sub menu + //!! pointer created in the call to Popup. + //!! Otherwise we would have a memory leak (see also #i107205#) + //((PopupMenu*)pMgr->GetSVMenu())->Execute( this, aPos ); + pMgr->Execute( aPos, this ); delete pMgr; - } - } - else - if (rCEvt.GetCommand() == COMMAND_WHEEL) - { - if (mrSidebarWin.IsScrollbarVisible()) - { - const CommandWheelData* pData = rCEvt.GetWheelData(); - if (pData->IsShift() || pData->IsMod1() || pData->IsMod2()) - { - mrDocView.HandleWheelCommands(rCEvt); - } - else - { - HandleScrollCommand( rCEvt, 0 , mrSidebarWin.Scrollbar()); - } - } - else - { - mrDocView.HandleWheelCommands(rCEvt); - } - } - else - { - if ( GetTextView() ) - GetTextView()->Command( rCEvt ); - else - Window::Command(rCEvt); - } + } + } + else + if (rCEvt.GetCommand() == COMMAND_WHEEL) + { + if (mrSidebarWin.IsScrollbarVisible()) + { + const CommandWheelData* pData = rCEvt.GetWheelData(); + if (pData->IsShift() || pData->IsMod1() || pData->IsMod2()) + { + mrDocView.HandleWheelCommands(rCEvt); + } + else + { + HandleScrollCommand( rCEvt, 0 , mrSidebarWin.Scrollbar()); + } + } + else + { + mrDocView.HandleWheelCommands(rCEvt); + } + } + else + { + if ( GetTextView() ) + GetTextView()->Command( rCEvt ); + else + Window::Command(rCEvt); + } } XubString SidebarTxtControl::GetSurroundingText() const { - if( GetTextView() ) - return GetTextView()->GetSurroundingText(); - else - return XubString::EmptyString(); + if( GetTextView() ) + return GetTextView()->GetSurroundingText(); + else + return XubString::EmptyString(); } Selection SidebarTxtControl::GetSurroundingTextSelection() const { - if( GetTextView() ) - return GetTextView()->GetSurroundingTextSelection(); - else - return Selection( 0, 0 ); + if( GetTextView() ) + return GetTextView()->GetSurroundingTextSelection(); + else + return Selection( 0, 0 ); } css::uno::Reference< css::accessibility::XAccessible > SidebarTxtControl::CreateAccessible() { - SidebarTxtControlAccessible* pAcc( new SidebarTxtControlAccessible( *this ) ); - css::uno::Reference< css::awt::XWindowPeer > xWinPeer( pAcc ); - SetWindowPeer( xWinPeer, pAcc ); + SidebarTxtControlAccessible* pAcc( new SidebarTxtControlAccessible( *this ) ); + css::uno::Reference< css::awt::XWindowPeer > xWinPeer( pAcc ); + SetWindowPeer( xWinPeer, pAcc ); - css::uno::Reference< css::accessibility::XAccessible > xAcc( xWinPeer, css::uno::UNO_QUERY ); - return xAcc; + css::uno::Reference< css::accessibility::XAccessible > xAcc( xWinPeer, css::uno::UNO_QUERY ); + return xAcc; } } } // end of namespace sw::sidebarwindows + +/* vim: set noet sw=4 ts=4: */