Tag: cws_src680_oj14
User: oj      
Date: 2007-05-11 13:32:24+0000
Modified:
   dba/reportdesign/inc/RptDef.hxx
   dba/reportdesign/source/ui/inc/ReportController.hxx
   dba/reportdesign/source/ui/report/ReportController.cxx

Log:
 #i77034# insert grahpic control with correct pos and size

File Changes:

Directory: /dba/reportdesign/inc/
=================================

File [changed]: RptDef.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/reportdesign/inc/RptDef.hxx?r1=1.1.2.1&r2=1.1.2.2
Delta lines:  +4 -3
-------------------
--- RptDef.hxx  2007-05-10 06:28:23+0000        1.1.2.1
+++ RptDef.hxx  2007-05-11 13:32:21+0000        1.1.2.2
@@ -6,9 +6,9 @@
  *
  *  $RCSfile: RptDef.hxx,v $
  *
- *  $Revision: 1.1.2.1 $
+ *  $Revision: 1.1.2.2 $
  *
- *  last change: $Author: oj $ $Date: 2007/05/10 06:28:23 $
+ *  last change: $Author: oj $ $Date: 2007/05/11 13:32:21 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -48,6 +48,7 @@
 #ifndef _COMPHELPER_UNO3_HXX_
 #include <comphelper/uno3.hxx>
 #endif
+#include <svx/fmglob.hxx>
 #include "dllapi.h"
 
 FORWARD_DECLARE_INTERFACE(report,XReportComponent)
@@ -65,7 +66,7 @@
 
 
 #define OBJ_DLG_FIXEDTEXT       ((UINT16) OBJ_MAXI + 1)
-#define OBJ_DLG_IMAGECONTROL    ((UINT16) OBJ_MAXI + 2)
+#define OBJ_DLG_IMAGECONTROL    OBJ_FM_IMAGECONTROL
 #define OBJ_DLG_FORMATTEDFIELD  ((UINT16) OBJ_MAXI + 3)
 #define OBJ_DLG_HFIXEDLINE      ((UINT16) OBJ_MAXI + 4)
 #define OBJ_DLG_VFIXEDLINE      ((UINT16) OBJ_MAXI + 5)

Directory: /dba/reportdesign/source/ui/inc/
===========================================

File [changed]: ReportController.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/reportdesign/source/ui/inc/ReportController.hxx?r1=1.1.2.3&r2=1.1.2.4
Delta lines:  +4 -3
-------------------
--- ReportController.hxx        2007-05-11 12:05:25+0000        1.1.2.3
+++ ReportController.hxx        2007-05-11 13:32:21+0000        1.1.2.4
@@ -6,9 +6,9 @@
  *
  *  $RCSfile: ReportController.hxx,v $
  *
- *  $Revision: 1.1.2.3 $
+ *  $Revision: 1.1.2.4 $
  *
- *  last change: $Author: oj $ $Date: 2007/05/11 12:05:25 $
+ *  last change: $Author: oj $ $Date: 2007/05/11 13:32:21 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -104,6 +104,7 @@
 #ifndef _COMPHELPER_IMPLEMENTATIONREFERENCE_HXX
 #include <comphelper/implementationreference.hxx>
 #endif
+#include "RptDef.hxx"
 #include <functional>
 #include <boost/shared_ptr.hpp>
 
@@ -169,7 +170,7 @@
         * \param _xSection the section where to create the formatted field
         * \param _sFunction the function which will be set at the data field.
         */
-        void createControls(const ::com::sun::star::uno::Sequence< 
::com::sun::star::beans::PropertyValue >& _aArgs,const 
::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& 
_xSection,const ::rtl::OUString& _sFunction );
+        void createControl(const ::com::sun::star::uno::Sequence< 
::com::sun::star::beans::PropertyValue >& _aArgs,const 
::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& 
_xSection,const ::rtl::OUString& _sFunction ,sal_uInt16 _nObjectId = 
OBJ_DLG_FORMATTEDFIELD);
         /** switch the report header/footer sectionon off with undo or without 
depending on the given id.
         *
         * \param _nId   Can either be SID_REPORTHEADER_WITHOUT_UNDO or 
SID_REPORTFOOTER_WITHOUT_UNDO or SID_REPORTHEADERFOOTER.

Directory: /dba/reportdesign/source/ui/report/
==============================================

File [changed]: ReportController.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/reportdesign/source/ui/report/ReportController.cxx?r1=1.1.2.3&r2=1.1.2.4
Delta lines:  +20 -19
---------------------
--- ReportController.cxx        2007-05-11 12:05:25+0000        1.1.2.3
+++ ReportController.cxx        2007-05-11 13:32:21+0000        1.1.2.4
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: ReportController.cxx,v $
  *
- *  $Revision: 1.1.2.3 $
+ *  $Revision: 1.1.2.4 $
  *
- *  last change: $Author: oj $ $Date: 2007/05/11 12:05:25 $
+ *  last change: $Author: oj $ $Date: 2007/05/11 13:32:21 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -2911,6 +2911,7 @@
        // build some arguments for the upcoming dialog
        try
        {
+        uno::Reference< report::XSection> xSection = 
m_pMyOwnView->getCurrentSection();
                ::sfx2::FileDialogHelper aDialog( 
ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW, SFXWB_GRAPHIC );
                aDialog.SetTitle( sTitle );
 
@@ -2924,16 +2925,10 @@
 
                if ( ERRCODE_NONE == aDialog.Execute() )
                {
-            uno::Reference<report::XSection> xSection = 
m_pMyOwnView->getCurrentSection();
-            if ( xSection.is() )
-            {
-                uno::Reference< lang::XMultiServiceFactory> 
xFac(xSection->getReportDefinition(),uno::UNO_QUERY);
-                uno::Reference< report::XImageControl > 
xImageControl(xFac->createInstance(SERVICE_IMAGECONTROL),uno::UNO_QUERY_THROW);
-                xImageControl->setImageURL(aDialog.GetPath());
-                xSection->add(xImageControl.get());
-                xImageControl->setPosition(awt::Point(0,0));
-                xImageControl->setSize(awt::Size(200,200));
-            }
+            uno::Sequence<beans::PropertyValue> aArgs(1);
+            aArgs[0].Name = PROPERTY_IMAGEURL;
+            aArgs[0].Value <<= ::rtl::OUString(aDialog.GetPath());
+            
createControl(aArgs,xSection,::rtl::OUString(),OBJ_DLG_IMAGECONTROL);
                }
        }
        catch(Exception&)
@@ -3048,7 +3043,7 @@
     return 0L;
 }
 // 
-----------------------------------------------------------------------------
-void OReportController::createControls(const Sequence< PropertyValue >& 
_aArgs,const uno::Reference< report::XSection>& _xSection,const 
::rtl::OUString& _sFunction )
+void OReportController::createControl(const Sequence< PropertyValue >& 
_aArgs,const uno::Reference< report::XSection>& _xSection,const 
::rtl::OUString& _sFunction,sal_uInt16 _nObjectId)
 {
     SequenceAsHashMap aMap(_aArgs);
     m_pMyOwnView->setMarked(_xSection ,sal_True);
@@ -3056,6 +3051,8 @@
     if ( !pReportSection )
         return;
 
+    OSL_ENSURE(pReportSection->getSection() == _xSection,"Invalid section 
after marking the corrct one.");
+
     sal_Int32 nLeftMargin = 
lcl_getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_LEFTMARGIN);
     const sal_Int32 nRightMargin = 
lcl_getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_RIGHTMARGIN);
     const sal_Int32 nPaperWidth = 
lcl_getStyleProperty<awt::Size>(m_xReportDefinition,PROPERTY_PAPERSIZE).Width - 
nRightMargin;
@@ -3066,7 +3063,7 @@
     SdrUnoObj* pLabel,*pControl;
     FmFormView::createControlLabelPair(NULL,m_pMyOwnView
                         ,nLeftMargin,0
-                        
,NULL,NULL,OBJ_DLG_FORMATTEDFIELD,::rtl::OUString(),ReportInventor,OBJ_DLG_FIXEDTEXT,
+                        
,NULL,NULL,_nObjectId,::rtl::OUString(),ReportInventor,OBJ_DLG_FIXEDTEXT,
                                            
NULL,pReportSection->getPage(),m_aReportModel.get(),
                                            pLabel,pControl);
 
@@ -3091,6 +3088,10 @@
     if ( nFormatKey && xInfo->hasPropertyByName(PROPERTY_FORMATKEY) )
         xUnoProp->setPropertyValue( PROPERTY_FORMATKEY, uno::makeAny( 
nFormatKey ) );
 
+    ::rtl::OUString sUrl = 
aMap.getUnpackedValueOrDefault(PROPERTY_IMAGEURL,::rtl::OUString());
+    if ( sUrl.getLength() && xInfo->hasPropertyByName(PROPERTY_IMAGEURL) )
+        xUnoProp->setPropertyValue( PROPERTY_IMAGEURL, uno::makeAny( sUrl ) );
+
     pObj->CreateMediator(sal_True);
     const sal_Int32 nShapeWidth = xShapeProp->getWidth();
     const bool bChangedPos = (aPos.X + nShapeWidth) > nPaperWidth;
@@ -3113,13 +3114,13 @@
 
     uno::Reference< report::XSection> xSection = 
aMap.getUnpackedValueOrDefault(PROPERTY_SECTION,uno::Reference< 
report::XSection>());
     ::rtl::OUString sFunction(RTL_CONSTASCII_USTRINGPARAM("TODAY()"));
-    createControls(aMap.getAsConstPropertyValueList(),xSection,sFunction);
+    createControl(aMap.getAsConstPropertyValueList(),xSection,sFunction);
     sal_Bool bTime = aMap.getUnpackedValueOrDefault(PROPERTY_STATE,sal_False);
     if ( bTime )
     {
         sFunction = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("NOW()"));
         aMap[PROPERTY_FORMATKEY] <<= 
aMap.getUnpackedValueOrDefault(PROPERTY_FORMATKEYTIME,sal_Int32(0));
-        createControls(aMap.getAsConstPropertyValueList(),xSection,sFunction);
+        createControl(aMap.getAsConstPropertyValueList(),xSection,sFunction);
     }
     
     getUndoMgr()->LeaveListAction();
@@ -3153,7 +3154,7 @@
     }
 
     sal_Bool bInPageHeader = 
aMap.getUnpackedValueOrDefault(PROPERTY_PAGEHEADERON,sal_True);
-    createControls(_aArgs,bInPageHeader ? m_xReportDefinition->getPageHeader() 
: m_xReportDefinition->getPageFooter(),sFunction);
+    createControl(_aArgs,bInPageHeader ? m_xReportDefinition->getPageHeader() 
: m_xReportDefinition->getPageFooter(),sFunction);
     
     getUndoMgr()->LeaveListAction();
 }




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to