summaryrefslogtreecommitdiff
path: root/sw/inc/anchoredobject.hxx
diff options
context:
space:
mode:
authorHans-Joachim Lankenau <hjs@openoffice.org>2004-06-28 12:29:16 +0000
committerHans-Joachim Lankenau <hjs@openoffice.org>2004-06-28 12:29:16 +0000
commit20db95b763c4e39602337ba35b4f68d49a27e983 (patch)
tree9cafb3b1c8574763a5f114d67f4981ad00c76cea /sw/inc/anchoredobject.hxx
parent75c1d8c4964826f99af842bfa11ec418a6e97ade (diff)
INTEGRATION: CWS swdrawpositioning (1.1.2); FILE ADDED
2004/06/01 12:01:09 od 1.1.2.3: #i26791# classes <SwAnchoredObject> and <SwAnchoredDrawObject> - method to set and convert positioning attributes. 2004/04/23 07:23:56 od 1.1.2.2: #i26791# - adjustments for the unification of the positioning of Writer fly frames and drawing objects 2004/04/07 08:58:17 od 1.1.2.1: #i26791# new class <SwAnchoredObject> for the unification of the positioning of Writer fly frames and drawing objects.
Diffstat (limited to 'sw/inc/anchoredobject.hxx')
-rw-r--r--sw/inc/anchoredobject.hxx223
1 files changed, 223 insertions, 0 deletions
diff --git a/sw/inc/anchoredobject.hxx b/sw/inc/anchoredobject.hxx
new file mode 100644
index 000000000000..015941114855
--- /dev/null
+++ b/sw/inc/anchoredobject.hxx
@@ -0,0 +1,223 @@
+/*************************************************************************
+ *
+ * $RCSfile: anchoredobject.hxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: hjs $ $Date: 2004-06-28 13:29:16 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _ANCHOREDOBJECT_HXX
+#define _ANCHOREDOBJECT_HXX
+
+#ifndef _RTTI_HXX
+#include <tools/rtti.hxx>
+#endif
+
+#ifndef _SWTYPES_HXX
+#include <swtypes.hxx>
+#endif
+#ifndef _SWRECT_HXX
+#include <swrect.hxx>
+#endif
+
+class SdrObject;
+class SwFrm;
+class SwLayoutFrm;
+class SwFrmFmt;
+class SwFmtAnchor;
+
+/** wrapper class for the positioning of Writer fly frames and drawing objects
+
+ OD 2004-03-22 #i26791#
+ Purpose of this class is to provide a unified interface for the positioning
+ of Writer fly frames (derived classes of <SwFlyFrm>) and of drawing objects
+ (derived classes of <SwDrawFrm>).
+
+ @author OD
+*/
+class SwAnchoredObject
+{
+ private:
+ // drawing object representing the anchored object in the drawing layer
+ SdrObject* mpDrawObj;
+ // frame the object is anchored at
+ SwFrm* mpAnchorFrm;
+ // last relative position
+ Point maRelPos;
+
+ // for to-character anchored objects:
+ // Last known anchor character retangle.
+ // Used to decide, if invalidation has to been performed, if anchor position
+ // has changed, and used to position object.
+ SwRect maLastCharRect;
+
+ // for to-character anchored objects:
+ // Last known top of line, in which the anchor character is in.
+ // Used to decide, if invalidation has to been performed, if anchor position
+ // has changed, and used to position object.
+ SwTwips mnLastTopOfLine;
+
+ // for to-paragraph and to-character anchored objects:
+ // Layout frame vertical position is orient at - typically its the upper
+ // of the anchor frame, but it could also by the upper of a follow or
+ // a following layout frame in the text flow.
+ const SwLayoutFrm* mpVertPosOrientFrm;
+
+ /** check anchor character rectangle
+
+ OD 2004-03-25 #i26791#
+ helper method for method <CheckCharRectAndTopOfLine()>
+ For to-character anchored Writer fly frames the member <maLastCharRect>
+ is updated. This is checked for change and depending on the applied
+ positioning, it's decided, if the Writer fly frame has to be invalidated.
+
+ @author OD
+
+ @param _rAnch
+ input parameter - reference to anchor position
+ */
+ void _CheckCharRect( const SwFmtAnchor& _rAnch );
+
+ /** check top of line
+
+ OD 2004-03-25 #i26791#
+ helper method for method <CheckCharRectAndTopOfLine()>
+ For to-character anchored Writer fly frames the member <mnLastTopOfLine>
+ is updated. This is checked for change and depending on the applied
+ positioning, it's decided, if the Writer fly frame has to be invalidated.
+
+ @author OD
+
+ @param _rAnch
+ input parameter - reference to anchor position
+ */
+ void _CheckTopOfLine( const SwFmtAnchor& _rAnch );
+
+ protected:
+ SwAnchoredObject();
+
+ void SetVertPosOrientFrm( const SwLayoutFrm& _rVertPosOrientFrm );
+
+ /** method to indicate, that anchored object is attached to a anchor frame
+
+ @author OD
+ */
+ virtual void ObjectAttachedToAnchorFrame();
+
+ public:
+ TYPEINFO();
+
+ virtual ~SwAnchoredObject();
+
+ // accessors to member <mpDrawObj>
+ void SetDrawObj( SdrObject& _rDrawObj );
+ const SdrObject* GetDrawObj() const;
+ SdrObject* DrawObj();
+
+ // accessors to member <mpAnchorFrm>
+ const SwFrm* GetAnchorFrm() const;
+ SwFrm* AnchorFrm();
+ void ChgAnchorFrm( SwFrm* _pNewAnchorFrm );
+
+ // accessors to data of position calculation
+ // frame vertical position is orient at
+ const SwLayoutFrm* GetVertPosOrientFrm() const;
+
+ /** check anchor character rectangle and top of line
+
+ OD 2004-03-25 #i26791#
+ For to-character anchored Writer fly frames the members <maLastCharRect>
+ and <maLastTopOfLine> are updated. These are checked for change and
+ depending on the applied positioning, it's decided, if the Writer fly
+ frame has to be invalidated.
+
+ @author OD
+ */
+ void CheckCharRectAndTopOfLine();
+
+ // accessors to member <maLastCharRect>
+ const SwRect& GetLastCharRect() const;
+ SwTwips GetLastCharX() const;
+ SwTwips GetRelCharX( const SwFrm* pFrm ) const;
+ SwTwips GetRelCharY( const SwFrm* pFrm ) const;
+ void AddLastCharY( long nDiff );
+ void ResetLastCharRectHeight();
+
+ // accessor to member <nmLastTopOfLine>
+ const SwTwips GetLastTopOfLine() const;
+
+ // method to determine position for the object and set the position
+ // at the object
+ virtual void MakeObjPos() = 0;
+ // invalidation of object position
+ virtual void InvalidateObjPos() = 0;
+ virtual void SetPositioningInProgress( const bool _bPosInProgress );
+ virtual bool IsPositioningInProgress() const;
+
+ // accessors to the current relative position
+ const Point GetCurrRelPos() const;
+ void SetCurrRelPos( Point _aRelPos );
+
+ // accessors to the format
+ virtual SwFrmFmt& GetFrmFmt() = 0;
+ virtual const SwFrmFmt& GetFrmFmt() const = 0;
+
+ // accessors to the object area and its position
+ virtual const SwRect GetObjRect() const = 0;
+ virtual void SetObjTop( const SwTwips _nTop) = 0;
+ virtual void SetObjLeft( const SwTwips _nLeft) = 0;
+};
+
+#endif