You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by or...@apache.org on 2012/08/20 13:46:47 UTC
svn commit: r1374979 [23/29] - in /incubator/ooo/branches/writer001: ./
ext_libraries/apr-util/ ext_libraries/apr-util/prj/ ext_libraries/apr/
ext_libraries/coinmp/ ext_libraries/hunspell/ ext_libraries/serf/
ext_libraries/serf/prj/ ext_sources/ extras...
Modified: incubator/ooo/branches/writer001/main/sc/source/ui/vba/vbawindow.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/ui/vba/vbawindow.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/ui/vba/vbawindow.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/ui/vba/vbawindow.cxx Mon Aug 20 11:46:19 2012
@@ -602,25 +602,33 @@ ScVbaWindow::getFreezePanes() throw (uno
}
void SAL_CALL
-ScVbaWindow::setFreezePanes( ::sal_Bool /*_bFreezePanes*/ ) throw (uno::RuntimeException)
+ScVbaWindow::setFreezePanes( ::sal_Bool _bFreezePanes ) throw (uno::RuntimeException)
{
uno::Reference< sheet::XViewPane > xViewPane( getController(), uno::UNO_QUERY_THROW );
uno::Reference< sheet::XViewSplitable > xViewSplitable( xViewPane, uno::UNO_QUERY_THROW );
uno::Reference< sheet::XViewFreezable > xViewFreezable( xViewPane, uno::UNO_QUERY_THROW );
- if( xViewSplitable->getIsWindowSplit() )
+ if( _bFreezePanes )
{
- // if there is a split we freeze at the split
- sal_Int32 nColumn = getSplitColumn();
- sal_Int32 nRow = getSplitRow();
- xViewFreezable->freezeAtPosition( nColumn, nRow );
+ if( xViewSplitable->getIsWindowSplit() )
+ {
+ // if there is a split we freeze at the split
+ sal_Int32 nColumn = getSplitColumn();
+ sal_Int32 nRow = getSplitRow();
+ xViewFreezable->freezeAtPosition( nColumn, nRow );
+ }
+ else
+ {
+ // otherwise we freeze in the center of the visible sheet
+ table::CellRangeAddress aCellRangeAddress = xViewPane->getVisibleRange();
+ sal_Int32 nColumn = aCellRangeAddress.StartColumn + (( aCellRangeAddress.EndColumn - aCellRangeAddress.StartColumn )/2 );
+ sal_Int32 nRow = aCellRangeAddress.StartRow + (( aCellRangeAddress.EndRow - aCellRangeAddress.StartRow )/2 );
+ xViewFreezable->freezeAtPosition( nColumn, nRow );
+ }
}
else
{
- // otherwise we freeze in the center of the visible sheet
- table::CellRangeAddress aCellRangeAddress = xViewPane->getVisibleRange();
- sal_Int32 nColumn = aCellRangeAddress.StartColumn + (( aCellRangeAddress.EndColumn - aCellRangeAddress.StartColumn )/2 );
- sal_Int32 nRow = aCellRangeAddress.StartRow + (( aCellRangeAddress.EndRow - aCellRangeAddress.StartRow )/2 );
- xViewFreezable->freezeAtPosition( nColumn, nRow );
+ //remove the freeze panes
+ xViewSplitable->splitAtPosition(0,0);
}
}
@@ -645,8 +653,7 @@ ScVbaWindow::setSplit( ::sal_Bool _bSpli
uno::Reference< excel::XRange > xRange = ActiveCell();
sal_Int32 nRow = xRange->getRow();
sal_Int32 nColumn = xRange->getColumn();
- xViewFreezable->freezeAtPosition( nColumn-1, nRow-1 );
- SplitAtDefinedPosition( sal_True );
+ SplitAtDefinedPosition( nColumn-1, nRow-1 );
}
}
@@ -663,10 +670,8 @@ ScVbaWindow::setSplitColumn( sal_Int32 _
if( getSplitColumn() != _splitcolumn )
{
uno::Reference< sheet::XViewFreezable > xViewFreezable( getController(), uno::UNO_QUERY_THROW );
- sal_Bool bFrozen = getFreezePanes();
sal_Int32 nRow = getSplitRow();
- xViewFreezable->freezeAtPosition( _splitcolumn, nRow );
- SplitAtDefinedPosition( !bFrozen );
+ SplitAtDefinedPosition( _splitcolumn, nRow );
}
}
@@ -689,8 +694,7 @@ sal_Int32 SAL_CALL
ScVbaWindow::getSplitRow() throw (uno::RuntimeException)
{
uno::Reference< sheet::XViewSplitable > xViewSplitable( getController(), uno::UNO_QUERY_THROW );
- sal_Int32 nValue = xViewSplitable->getSplitRow();
- return nValue ? nValue - 1 : nValue;
+ return xViewSplitable->getSplitRow();
}
void SAL_CALL
@@ -699,10 +703,8 @@ ScVbaWindow::setSplitRow( sal_Int32 _spl
if( getSplitRow() != _splitrow )
{
uno::Reference< sheet::XViewFreezable > xViewFreezable( getController(), uno::UNO_QUERY_THROW );
- sal_Bool bFrozen = getFreezePanes();
sal_Int32 nColumn = getSplitColumn();
- xViewFreezable->freezeAtPosition( nColumn , _splitrow );
- SplitAtDefinedPosition( !bFrozen );
+ SplitAtDefinedPosition( nColumn, _splitrow );
}
}
@@ -721,15 +723,30 @@ ScVbaWindow::setSplitVertical(double _sp
xViewSplitable->splitAtPosition( 0, static_cast<sal_Int32>( fVertiPixels ) );
}
-void ScVbaWindow::SplitAtDefinedPosition(sal_Bool _bUnFreezePane)
+void ScVbaWindow::SplitAtDefinedPosition( sal_Int32 nColumns, sal_Int32 nRows )
{
uno::Reference< sheet::XViewSplitable > xViewSplitable( getController(), uno::UNO_QUERY_THROW );
uno::Reference< sheet::XViewFreezable > xViewFreezable( xViewSplitable, uno::UNO_QUERY_THROW );
- sal_Int32 nVertSplit = xViewSplitable->getSplitVertical();
- sal_Int32 nHoriSplit = xViewSplitable->getSplitHorizontal();
- if( _bUnFreezePane )
- xViewFreezable->freezeAtPosition(0,0);
- xViewSplitable->splitAtPosition(nHoriSplit, nVertSplit);
+ // nColumns and nRows means split columns/rows
+ if( nColumns == 0 && nRows == 0 )
+ return;
+
+ sal_Int32 cellColumn = nColumns + 1;
+ sal_Int32 cellRow = nRows + 1;
+
+ ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
+ if ( pViewShell )
+ {
+ //firstly remove the old splitter
+ xViewSplitable->splitAtPosition(0,0);
+
+ uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW );
+ uno::Reference< excel::XWorksheet > xSheet( xApplication->getActiveSheet(), uno::UNO_QUERY_THROW );
+ xSheet->Cells(uno::makeAny(cellRow), uno::makeAny(cellColumn))->Select();
+
+ //pViewShell->FreezeSplitters( FALSE );
+ dispatchExecute( pViewShell, SID_WINDOW_SPLIT );
+ }
}
uno::Any SAL_CALL
@@ -778,8 +795,18 @@ ScVbaWindow::ActiveSheet( ) throw (scri
uno::Any SAL_CALL
ScVbaWindow::getView() throw (uno::RuntimeException)
{
- // not supported now
- sal_Int32 nWindowView = excel::XlWindowView::xlNormalView;
+ sal_Bool bPageBreak = sal_False;
+ sal_Int32 nWindowView = excel::XlWindowView::xlNormalView;
+
+ ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
+ if (pViewShell)
+ bPageBreak = pViewShell->GetViewData()->IsPagebreakMode();
+
+ if( bPageBreak )
+ nWindowView = excel::XlWindowView::xlPageBreakPreview;
+ else
+ nWindowView = excel::XlWindowView::xlNormalView;
+
return uno::makeAny( nWindowView );
}
Modified: incubator/ooo/branches/writer001/main/sc/source/ui/vba/vbawindow.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/ui/vba/vbawindow.hxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/ui/vba/vbawindow.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/ui/vba/vbawindow.hxx Mon Aug 20 11:46:19 2012
@@ -49,7 +49,7 @@ private:
css::uno::Reference< css::awt::XDevice > getDevice() throw (css::uno::RuntimeException);
protected:
- void SplitAtDefinedPosition(sal_Bool _bUnFreezePane);
+ void SplitAtDefinedPosition( sal_Int32 nColumns, sal_Int32 nRows );
public:
void Scroll( const css::uno::Any& Down, const css::uno::Any& Up, const css::uno::Any& ToRight, const css::uno::Any& ToLeft, bool bLargeScroll = false ) throw (css::uno::RuntimeException);
Modified: incubator/ooo/branches/writer001/main/sc/source/ui/view/cellsh2.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/ui/view/cellsh2.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/ui/view/cellsh2.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/ui/view/cellsh2.cxx Mon Aug 20 11:46:19 2012
@@ -357,7 +357,8 @@ void ScCellShell::ExecuteDB( SfxRequest&
ScSubTotalParam aSubTotalParam;
SfxItemSet aArgSet( GetPool(), SCITEM_SUBTDATA, SCITEM_SUBTDATA );
- ScDBData* pDBData = pTabViewShell->GetDBData();
+ //ScDBData* pDBData = pTabViewShell->GetDBData();
+ ScDBData* pDBData = pTabViewShell->GetDBData(sal_True, SC_DB_MAKE_SUBTOTAL);
pDBData->GetSubTotalParam( aSubTotalParam );
aSubTotalParam.bRemoveOnly = sal_False;
@@ -411,7 +412,7 @@ void ScCellShell::ExecuteDB( SfxRequest&
//#i60401 ux-ctest: Calc does not support all users' strategies regarding sorting data
//the patch comes from maoyg
ScSortParam aSortParam;
- ScDBData* pDBData = pTabViewShell->GetDBData();
+ ScDBData* pDBData = pTabViewShell->GetDBData(sal_True, SC_DB_MAKE_SORT);
ScViewData* pData = GetViewData();
pDBData->GetSortParam( aSortParam );
@@ -462,7 +463,7 @@ void ScCellShell::ExecuteDB( SfxRequest&
if ( pArgs ) // Basic
{
ScSortParam aSortParam;
- ScDBData* pDBData = pTabViewShell->GetDBData();
+ ScDBData* pDBData = pTabViewShell->GetDBData(sal_True, SC_DB_MAKE_SORT);
ScViewData* pData = GetViewData();
pDBData->GetSortParam( aSortParam );
@@ -525,7 +526,7 @@ void ScCellShell::ExecuteDB( SfxRequest&
else
{
ScSortParam aSortParam;
- ScDBData* pDBData = pTabViewShell->GetDBData();
+ ScDBData* pDBData = pTabViewShell->GetDBData(sal_True, SC_DB_MAKE_SORT);
ScViewData* pData = GetViewData();
pDBData->GetSortParam( aSortParam );
@@ -680,7 +681,7 @@ void ScCellShell::ExecuteDB( SfxRequest&
case SID_UNFILTER:
{
ScQueryParam aParam;
- ScDBData* pDBData = pTabViewShell->GetDBData();
+ ScDBData* pDBData = pTabViewShell->GetDBData(sal_True, SC_DB_OLD_FILTER);
pDBData->GetQueryParam( aParam );
SCSIZE nEC = aParam.GetEntryCount();
Modified: incubator/ooo/branches/writer001/main/sc/source/ui/view/dbfunc.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/ui/view/dbfunc.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/ui/view/dbfunc.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/ui/view/dbfunc.cxx Mon Aug 20 11:46:19 2012
@@ -334,35 +334,37 @@ void ScDBFunc::ToggleAutoFilter()
ScQueryParam aParam;
ScDocument* pDoc = GetViewData()->GetDocument();
- ScDBData* pDBData = GetDBData( sal_False, SC_DB_MAKE, SC_DBSEL_ROW_DOWN );
+ ScDBData* pDBData = GetDBData( sal_False, SC_DB_OLD_FILTER, SC_DBSEL_ROW_DOWN );
- pDBData->SetByRow( sal_True ); //! Undo, vorher abfragen ??
- pDBData->GetQueryParam( aParam );
+
SCCOL nCol;
- SCROW nRow = aParam.nRow1;
+ SCROW nRow;
SCTAB nTab = GetViewData()->GetTabNo();
sal_Int16 nFlag;
- sal_Bool bHasAuto = sal_True;
- sal_Bool bHeader = pDBData->HasHeader();
+ //sal_Bool bHasAuto = sal_True;
+ sal_Bool bHeader;
sal_Bool bPaint = sal_False;
//! stattdessen aus DB-Bereich abfragen?
- for (nCol=aParam.nCol1; nCol<=aParam.nCol2 && bHasAuto; nCol++)
+ /*for (nCol=aParam.nCol1; nCol<=aParam.nCol2 && bHasAuto; nCol++)
{
nFlag = ((ScMergeFlagAttr*) pDoc->
GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG ))->GetValue();
if ( (nFlag & SC_MF_AUTO) == 0 )
bHasAuto = sal_False;
- }
+ }*/
- if (bHasAuto) // aufheben
+ if (pDBData && pDBData->HasAutoFilter()) // aufheben
{
// Filterknoepfe ausblenden
-
+ pDBData->SetByRow( sal_True ); //! Undo, vorher abfragen ??
+ pDBData->GetQueryParam( aParam );
+ nRow = aParam.nRow1;
+ bHeader = pDBData->HasHeader();
for (nCol=aParam.nCol1; nCol<=aParam.nCol2; nCol++)
{
nFlag = ((ScMergeFlagAttr*) pDoc->
@@ -396,6 +398,12 @@ void ScDBFunc::ToggleAutoFilter()
}
else // Filterknoepfe einblenden
{
+ pDBData = GetDBData(sal_False, SC_DB_MAKE_FILTER);
+ pDBData->SetByRow(sal_True);
+ pDBData->GetQueryParam(aParam);
+ nRow = aParam.nRow1;
+ bHeader = pDBData->HasHeader();
+
if ( !pDoc->IsBlockEmpty( nTab,
aParam.nCol1, aParam.nRow1,
aParam.nCol2, aParam.nRow2 ) )
@@ -457,7 +465,8 @@ void ScDBFunc::HideAutoFilter()
ScDocument* pDoc = pDocSh->GetDocument();
ScQueryParam aParam;
- ScDBData* pDBData = GetDBData( sal_False );
+ //ScDBData* pDBData = GetDBData( FALSE );
+ ScDBData* pDBData = GetDBData(sal_False, SC_DB_OLD_FILTER);
SCTAB nTab;
SCCOL nCol1, nCol2;
Modified: incubator/ooo/branches/writer001/main/sc/source/ui/view/drawview.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/ui/view/drawview.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/ui/view/drawview.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/ui/view/drawview.cxx Mon Aug 20 11:46:19 2012
@@ -42,6 +42,7 @@
#include <svx/sdrpaintwindow.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/viewfrm.hxx>
+#include <svx/sdrundomanager.hxx>
#include "drawview.hxx"
#include "global.hxx"
@@ -59,6 +60,7 @@
#include "userdat.hxx"
#include "postit.hxx"
#include "undocell.hxx"
+#include "document.hxx"
#include "sc.hrc"
@@ -814,28 +816,10 @@ void ScDrawView::MarkDropObj( SdrObject*
}
}
-//UNUSED2009-05 void ScDrawView::CaptionTextDirection( sal_uInt16 nSlot )
-//UNUSED2009-05 {
-//UNUSED2009-05 if(nSlot != SID_TEXTDIRECTION_LEFT_TO_RIGHT && nSlot != SID_TEXTDIRECTION_TOP_TO_BOTTOM)
-//UNUSED2009-05 return;
-//UNUSED2009-05
-//UNUSED2009-05 SdrObject* pObject = GetTextEditObject();
-//UNUSED2009-05 if ( ScDrawLayer::IsNoteCaption( pObject ) )
-//UNUSED2009-05 {
-//UNUSED2009-05 if( SdrCaptionObj* pCaption = dynamic_cast< SdrCaptionObj* >( pObject ) )
-//UNUSED2009-05 {
-//UNUSED2009-05 SfxItemSet aAttr(pCaption->GetMergedItemSet());
-//UNUSED2009-05 aAttr.Put( SvxWritingModeItem(
-//UNUSED2009-05 nSlot == SID_TEXTDIRECTION_LEFT_TO_RIGHT ?
-//UNUSED2009-05 com::sun::star::text::WritingMode_LR_TB : com::sun::star::text::WritingMode_TB_RL,
-//UNUSED2009-05 SDRATTR_TEXTDIRECTION ) );
-//UNUSED2009-05 pCaption->SetMergedItemSet(aAttr);
-//UNUSED2009-05 FuPoor* pPoor = pViewData->GetView()->GetDrawFuncPtr();
-//UNUSED2009-05 if ( pPoor )
-//UNUSED2009-05 {
-//UNUSED2009-05 FuText* pText = static_cast<FuText*>(pPoor);
-//UNUSED2009-05 pText->StopEditMode(sal_True);
-//UNUSED2009-05 }
-//UNUSED2009-05 }
-//UNUSED2009-05 }
-//UNUSED2009-05 }
+// support enhanced text edit for draw objects
+SdrUndoManager* ScDrawView::getSdrUndoManagerForEnhancedTextEdit() const
+{
+ return pDoc ? dynamic_cast< SdrUndoManager* >(pDoc->GetUndoManager()) : 0;
+}
+
+// eof
Modified: incubator/ooo/branches/writer001/main/sc/source/ui/view/tabvwshc.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/ui/view/tabvwshc.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/ui/view/tabvwshc.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/ui/view/tabvwshc.cxx Mon Aug 20 11:46:19 2012
@@ -171,7 +171,7 @@ SfxModelessDialog* ScTabViewShell::Creat
SCITEM_QUERYDATA,
SCITEM_QUERYDATA );
- ScDBData* pDBData = GetDBData( sal_True, SC_DB_MAKE, SC_DBSEL_ROW_DOWN);
+ ScDBData* pDBData = GetDBData( sal_True, SC_DB_MAKE_FILTER, SC_DBSEL_ROW_DOWN);
pDBData->GetQueryParam( aQueryParam );
ScQueryItem aItem( SCITEM_QUERYDATA, GetViewData(), &aQueryParam );
@@ -196,7 +196,7 @@ SfxModelessDialog* ScTabViewShell::Creat
SCITEM_QUERYDATA,
SCITEM_QUERYDATA );
- ScDBData* pDBData = GetDBData( sal_True, SC_DB_MAKE, SC_DBSEL_ROW_DOWN);
+ ScDBData* pDBData = GetDBData( sal_True, SC_DB_MAKE_FILTER, SC_DBSEL_ROW_DOWN);
pDBData->GetQueryParam( aQueryParam );
aArgSet.Put( ScQueryItem( SCITEM_QUERYDATA,
Modified: incubator/ooo/branches/writer001/main/sc/source/ui/view/viewdata.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/ui/view/viewdata.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/ui/view/viewdata.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/ui/view/viewdata.cxx Mon Aug 20 11:46:19 2012
@@ -2585,6 +2585,9 @@ void ScViewData::ReadExtOptions( const S
double nFactor = pDocShell->GetOutputFactor();
aPixel.X() = (long)( aPixel.X() * nFactor + 0.5 );
}
+
+ bHSplit = bHSplit && aPixel.X() > 0;
+ bVSplit = bVSplit && aPixel.Y() > 0;
if( bHSplit )
{
rViewTab.eHSplitMode = SC_SPLIT_NORMAL;
@@ -2813,6 +2816,7 @@ void ScViewData::ReadUserDataSequence(co
uno::Sequence<beans::PropertyValue> aTabSettings;
if (aAny >>= aTabSettings)
{
+ delete pTabData[nTab];
pTabData[nTab] = new ScViewDataTable;
bool bHasZoom = false;
pTabData[nTab]->ReadUserDataSequence(aTabSettings, *this, nTab, bHasZoom);
Modified: incubator/ooo/branches/writer001/main/sc/workben/celltrans/parse.py
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/workben/celltrans/parse.py?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/workben/celltrans/parse.py (original)
+++ incubator/ooo/branches/writer001/main/sc/workben/celltrans/parse.py Mon Aug 20 11:46:19 2012
@@ -62,8 +62,7 @@ class LocaleData(object):
chars += "\"), OUString(), OUString());\n\n"
# pre instantiations of localized function names.
- funcs = self.funcList.keys()
- funcs.sort()
+ funcs = sorted(self.funcList.keys())
chars += "// pre instantiations of localized function names\n"
for func in funcs:
for item in self.funcList[func]:
@@ -191,7 +190,7 @@ class Parser(object):
chars = "// This file has been automatically generated. Do not hand-edit this!\n"
for obj in localeList:
chars += "\n" + obj.dumpCode()
-
+
# Write to output file.
file = open(self.outfile, 'w')
file.write(chars)
@@ -200,4 +199,3 @@ class Parser(object):
if __name__=='__main__':
parser = Parser(sys.argv)
parser.parse()
-
Modified: incubator/ooo/branches/writer001/main/sccomp/source/solver/makefile.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sccomp/source/solver/makefile.mk?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sccomp/source/solver/makefile.mk (original)
+++ incubator/ooo/branches/writer001/main/sccomp/source/solver/makefile.mk Mon Aug 20 11:46:19 2012
@@ -58,14 +58,22 @@ SHL1STDLIBS= $(COMPHELPERLIB) \
$(CPPUHELPERLIB) \
$(CPPULIB) \
$(SALLIB) \
- $(TOOLSLIB) \
- $(COINMPLIBS)
+ $(TOOLSLIB)
SHL1DEPN= makefile.mk
SHL1DEF= $(MISC)$/$(SHL1TARGET).def
SHL1VERSIONMAP= $(SOLARENV)/src/component.map
DEF1NAME= $(SHL1TARGET)
+.IF "$(SYSTEM_COINMP)" == "YES"
+CFLAGS+= $(COINMP_CFLAGS) -DSYSTEM_COINMP
+# Use the library flags from configure
+SHL1STDLIBS+=$(COINMP_LIBS)
+.ELSE
+# Use the library flags from solenv
+SHL1STDLIBS+=$(COINMPLIBS)
+.ENDIF
+
# --- Resources --------------------------------
RESLIB1LIST=$(SRS)$/solver.srs
Modified: incubator/ooo/branches/writer001/main/sccomp/source/solver/solver.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sccomp/source/solver/solver.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sccomp/source/solver/solver.cxx (original)
+++ incubator/ooo/branches/writer001/main/sccomp/source/solver/solver.cxx Mon Aug 20 11:46:19 2012
@@ -20,8 +20,11 @@
*************************************************************/
-
+#ifdef SYSTEM_COINMP
+#include <coin/CoinMP.h>
+#else
#include <coinmp/CoinMP.h>
+#endif
#include "solver.hxx"
#include "solver.hrc"
Modified: incubator/ooo/branches/writer001/main/scp2/prj/build.lst
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/scp2/prj/build.lst?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/scp2/prj/build.lst (original)
+++ incubator/ooo/branches/writer001/main/scp2/prj/build.lst Mon Aug 20 11:46:19 2012
@@ -1,4 +1,4 @@
-cp scp2 : L10N:l10n i18npool setup_native l10ntools PYTHON:python ICU:icu REDLAND:redland LIBXSLT:libxslt serf NULL
+cp scp2 : L10N:l10n i18npool setup_native l10ntools PYTHON:python ICU:icu REDLAND:redland LIBXSLT:libxslt APR:apr apr-util SERF:serf NULL
cp scp2 usr1 - all cp_mkout NULL
cp scp2\macros nmake - all cp_langmacros NULL
cp scp2\source\templates nmake - all cp_langtemplates NULL
Modified: incubator/ooo/branches/writer001/main/scp2/source/binfilter/file_binfilter.scp
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/scp2/source/binfilter/file_binfilter.scp?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/scp2/source/binfilter/file_binfilter.scp (original)
+++ incubator/ooo/branches/writer001/main/scp2/source/binfilter/file_binfilter.scp Mon Aug 20 11:46:19 2012
@@ -52,10 +52,19 @@ STD_LIB_FILE( gid_File_Lib_Bf_Sc, bf_sc)
STD_LIB_FILE( gid_File_Lib_Bf_Sd, bf_sd)
STD_LIB_FILE( gid_File_Lib_Bf_Sm, bf_sm)
STD_LIB_FILE( gid_File_Lib_Bf_Sw, bf_sw)
+#ifdef OS2
+STD_LIB_FILE( gid_File_Lib_Bf_Wrapper, bf_wrapp)
+STD_LIB_FILE( gid_File_Lib_Legacy_Binfilters, legacy_b)
+#else
STD_LIB_FILE( gid_File_Lib_Bf_Wrapper, bf_wrapper)
STD_LIB_FILE( gid_File_Lib_Legacy_Binfilters, legacy_binfilters)
+#endif
+#ifdef OS2
+STD_LIB_FILE( gid_File_Lib_Bf_Migratefilter, bf_migra)
+#else
STD_LIB_FILE( gid_File_Lib_Bf_Migratefilter, bf_migratefilter)
+#endif
STD_LIB_FILE( gid_File_Lib_Bindet, bindet)
STD_RES_FILE( gid_File_Res_Bf_Sch, bf_sch )
Modified: incubator/ooo/branches/writer001/main/scp2/source/calc/file_calc.scp
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/scp2/source/calc/file_calc.scp?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/scp2/source/calc/file_calc.scp (original)
+++ incubator/ooo/branches/writer001/main/scp2/source/calc/file_calc.scp Mon Aug 20 11:46:19 2012
@@ -64,7 +64,9 @@ File gid_File_Lib_CbcSolver
Name = SPECIAL_NAME_VER(CbcSolver,3);
PACKED_LIB_FILE_BODY;
End
-#else
+#endif
+
+#ifdef ADD_MAIN_COINMP_LIBRARY
// On Windows only the CoinMP library is built and used.
// Version numbering is not used either.
File gid_File_Lib_CoinMP
Modified: incubator/ooo/branches/writer001/main/scp2/source/calc/makefile.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/scp2/source/calc/makefile.mk?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/scp2/source/calc/makefile.mk (original)
+++ incubator/ooo/branches/writer001/main/scp2/source/calc/makefile.mk Mon Aug 20 11:46:19 2012
@@ -35,10 +35,14 @@ TARGETTYPE=CUI
.IF "$(ENABLE_COINMP)" == "YES"
SCPDEFS+=-DENABLE_COINMP
+.IF "$(SYSTEM_COINMP)" == "NO"
.IF "$(GUI)"!="WNT"
# For the non-Windows platforms all libraries related to CoinMP have to be
# added explicitly.
SCPDEFS+=-DADD_ALL_COINMP_LIBRARIES
+.ELSE
+SCPDEFS+=-DADD_MAIN_COINMP_LIBRARY
+.ENDIF
.ENDIF
.ENDIF
Modified: incubator/ooo/branches/writer001/main/scp2/source/ooo/common_brand.scp
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/scp2/source/ooo/common_brand.scp?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/scp2/source/ooo/common_brand.scp (original)
+++ incubator/ooo/branches/writer001/main/scp2/source/ooo/common_brand.scp Mon Aug 20 11:46:19 2012
@@ -48,6 +48,7 @@ Module gid_Module_Root_Brand
gid_Brand_File_Bin_Crashreport_Script,
gid_Brand_File_Bin_Crashreport_Com,
gid_Brand_File_Bin_Python,
+ gid_Brand_File_Bin_Quickstart_Os2,
gid_Brand_File_Bin_Soffice,
gid_Brand_File_Bin_Soffice_Bin,
gid_Brand_File_Bin_Soffice_Bin_Manifest,
@@ -1324,3 +1325,12 @@ File gid_Brand_File_Bin_Python
Styles = (PACKED);
End
#endif
+
+#ifdef OS2
+File gid_Brand_File_Bin_Quickstart_Os2
+ TXT_FILE_BODY;
+ Styles = (PACKED);
+ Dir = gid_Brand_Dir_Program;
+ Name = "quickstart.exe";
+End
+#endif
Modified: incubator/ooo/branches/writer001/main/scp2/source/ooo/directory_ooo.scp
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/scp2/source/ooo/directory_ooo.scp?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/scp2/source/ooo/directory_ooo.scp (original)
+++ incubator/ooo/branches/writer001/main/scp2/source/ooo/directory_ooo.scp Mon Aug 20 11:46:19 2012
@@ -420,6 +420,16 @@ Directory gid_Dir_Share_Xslt_Import_uof
ParentID = gid_Dir_Share_Xslt_Import;
DosName = "uof";
End
+/// Begin for uof2-filter
+Directory gid_Dir_Share_Xslt_Export_uof2
+ ParentID = gid_Dir_Share_Xslt_Export;
+ DosName = "uof2";
+End
+Directory gid_Dir_Share_Xslt_Import_uof2
+ ParentID = gid_Dir_Share_Xslt_Import;
+ DosName = "uof2";
+End
+/// End
Directory gid_Dir_Share_Xslt_Export_Wordml
ParentID = gid_Dir_Share_Xslt_Export;
DosName = "wordml";
Modified: incubator/ooo/branches/writer001/main/scp2/source/ooo/file_library_ooo.scp
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/scp2/source/ooo/file_library_ooo.scp?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/scp2/source/ooo/file_library_ooo.scp (original)
+++ incubator/ooo/branches/writer001/main/scp2/source/ooo/file_library_ooo.scp Mon Aug 20 11:46:19 2012
@@ -2002,8 +2002,10 @@ End
#endif
#endif
+// AF: is this still needed with explicit support for system apr,apr-util,serf ?
#if !defined(OS2) // using system libs
+#ifdef APR_MAJOR
File gid_File_Lib_Apr
#ifdef WNT
Name = SPECIAL_NAME(libapr-1);
@@ -2020,7 +2022,9 @@ File gid_File_Lib_Apr
#endif
PACKED_LIB_FILE_BODY;
End
+#endif
+#ifdef APR_UTIL_MAJOR
File gid_File_Lib_AprUtil
#ifdef WNT
Name = SPECIAL_NAME(apr-util);
@@ -2037,7 +2041,9 @@ File gid_File_Lib_AprUtil
#endif
PACKED_LIB_FILE_BODY;
End
+#endif
+#ifdef SERF_MAJOR
File gid_File_Lib_Serf
#ifdef WNT
Name = SPECIAL_NAME(serf);
@@ -2054,5 +2060,6 @@ File gid_File_Lib_Serf
#endif
PACKED_LIB_FILE_BODY;
End
+#endif
#endif // !defined(OS2)
Modified: incubator/ooo/branches/writer001/main/scp2/source/ooo/file_ooo.scp
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/scp2/source/ooo/file_ooo.scp?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/scp2/source/ooo/file_ooo.scp (original)
+++ incubator/ooo/branches/writer001/main/scp2/source/ooo/file_ooo.scp Mon Aug 20 11:46:19 2012
@@ -1445,6 +1445,21 @@ File gid_File_Xsl_Import_uof_uof2odf_pre
Dir = gid_Dir_Share_Xslt_Import_uof;
Name = "/xslt/import/uof/uof2odf_presentation.xsl";
End
+///Begin for uof2-filter
+File gid_File_Xsl_Export_uof2_odf2uof
+ TXT_FILE_BODY;
+ Styles = (PACKED);
+ Dir = gid_Dir_Share_Xslt_Export_uof2;
+ Name = "/xslt/export/uof2/odf2uof.xsl";
+End
+
+File gid_File_Xsl_Import_uof2_uof2odf
+ TXT_FILE_BODY;
+ Styles = (PACKED);
+ Dir = gid_Dir_Share_Xslt_Import_uof2;
+ Name = "/xslt/import/uof2/uof2odf.xsl";
+End
+/// End
File gid_File_Xsl_Export_Wordml_Ooo2wordml_Border
TXT_FILE_BODY;
Styles = (PACKED);
Modified: incubator/ooo/branches/writer001/main/scp2/source/ooo/file_resource_ooo.scp
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/scp2/source/ooo/file_resource_ooo.scp?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/scp2/source/ooo/file_resource_ooo.scp (original)
+++ incubator/ooo/branches/writer001/main/scp2/source/ooo/file_resource_ooo.scp Mon Aug 20 11:46:19 2012
@@ -53,13 +53,8 @@ STD_RES_FILE( gid_File_Res_Gal, gal )
STD_RES_FILE( gid_File_Res_Imp, imp )
-#ifdef OS2
-STD_RES_FILE( gid_File_Res_Deployment, deploy )
-STD_RES_FILE( gid_File_Res_DeploymentGui, deplgui )
-#else
STD_RES_FILE( gid_File_Res_Deployment, deployment )
STD_RES_FILE( gid_File_Res_DeploymentGui, deploymentgui )
-#endif
STD_RES_FILE( gid_File_Res_Ofa, ofa )
Modified: incubator/ooo/branches/writer001/main/scp2/source/ooo/makefile.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/scp2/source/ooo/makefile.mk?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/scp2/source/ooo/makefile.mk (original)
+++ incubator/ooo/branches/writer001/main/scp2/source/ooo/makefile.mk Mon Aug 20 11:46:19 2012
@@ -241,19 +241,27 @@ SCPDEFS+=-DDISABLE_ATL
.ENDIF
# Detect version numbers for apr, apr-util, serf.
+.IF "$(SYSTEM_APR)"!="YES"
.INCLUDE : apr_version.mk
-.INCLUDE : aprutil_version.mk
-.INCLUDE : serf_version.mk
SCPDEFS+=\
-DAPR_MAJOR=$(APR_MAJOR) \
-DAPR_MINOR=$(APR_MINOR) \
- -DAPR_MICRO=$(APR_MICRO) \
+ -DAPR_MICRO=$(APR_MICRO)
+.ENDIF
+.IF "$(SYSTEM_APR_UTIL)"!="YES"
+.INCLUDE : aprutil_version.mk
+SCPDEFS+=\
-DAPR_UTIL_MAJOR=$(APR_UTIL_MAJOR) \
-DAPR_UTIL_MINOR=$(APR_UTIL_MINOR) \
- -DAPR_UTIL_MICRO=$(APR_UTIL_MICRO) \
+ -DAPR_UTIL_MICRO=$(APR_UTIL_MICRO)
+.ENDIF
+.IF "$(SYSTEM_SERF)"!="YES"
+.INCLUDE : serf_version.mk
+SCPDEFS+=\
-DSERF_MAJOR=$(SERF_MAJOR) \
-DSERF_MINOR=$(SERF_MINOR) \
-DSERF_MICRO=$(SERF_MICRO)
+.ENDIF
.IF "$(SYSTEM_PYTHON)" == "YES"
SCPDEFS+=-DSYSTEM_PYTHON
@@ -303,6 +311,10 @@ SCPDEFS+=-DSYSTEM_LIBJPEG
SCPDEFS+=-DSYSTEM_PANGO
.ENDIF
+
+# The variables ENABLE_ONLINE_UPDATE, WITHOUT_MATHMLDTD, WITH_CATA_FONTS, WITH_CATB_FONTS,
+# and WITHOUT_PPDS are added (or not) in configure to SCPDEFS.
+
SCP_PRODUCT_TYPE=osl
ICUVERSION_DEPENDENT_FILES= \
Modified: incubator/ooo/branches/writer001/main/scp2/source/ooo/module_hidden_ooo.scp
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/scp2/source/ooo/module_hidden_ooo.scp?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/scp2/source/ooo/module_hidden_ooo.scp (original)
+++ incubator/ooo/branches/writer001/main/scp2/source/ooo/module_hidden_ooo.scp Mon Aug 20 11:46:19 2012
@@ -186,6 +186,7 @@ Module gid_Module_Root_Files_4
gid_File_Lib_Lng,
gid_File_Lib_Offacc,
gid_File_Lib_Oox,
+ gid_File_Lib_Uof,
gid_File_Lib_Pcr,
gid_File_Lib_Pdffilter,
gid_File_Lib_Pk,
Modified: incubator/ooo/branches/writer001/main/scp2/source/ooo/shortcut_ooo.scp
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/scp2/source/ooo/shortcut_ooo.scp?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/scp2/source/ooo/shortcut_ooo.scp (original)
+++ incubator/ooo/branches/writer001/main/scp2/source/ooo/shortcut_ooo.scp Mon Aug 20 11:46:19 2012
@@ -96,6 +96,7 @@ End
// The major version number is handled in a non-standard way (part of the name).
// Therefore the hard-coded .0 suffix.
+#ifdef APR_MAJOR
Shortcut gid_Shortcut_Lib_Apr
FileID = gid_File_Lib_Apr;
Dir = SCP2_OOO_BIN_DIR;
@@ -106,7 +107,9 @@ Shortcut gid_Shortcut_Lib_Apr
#endif
Styles = (NETWORK,RELATIVE,FORCE_INTO_UPDATE_PACKAGE);
End
+#endif
+#ifdef APR_UTIL_MAJOR
Shortcut gid_Shortcut_Lib_AprUtil
FileID = gid_File_Lib_AprUtil;
Dir = SCP2_OOO_BIN_DIR;
@@ -117,7 +120,9 @@ Shortcut gid_Shortcut_Lib_AprUtil
#endif
Styles = (NETWORK,RELATIVE,FORCE_INTO_UPDATE_PACKAGE);
End
+#endif
+#ifdef SERF_MAJOR
Shortcut gid_Shortcut_Lib_Serf
FileID = gid_File_Lib_Serf;
Dir = SCP2_OOO_BIN_DIR;
@@ -128,6 +133,7 @@ Shortcut gid_Shortcut_Lib_Serf
#endif
Styles = (NETWORK,RELATIVE,FORCE_INTO_UPDATE_PACKAGE);
End
+#endif
#endif
Modified: incubator/ooo/branches/writer001/main/scripting/examples/python/Capitalise.py
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/scripting/examples/python/Capitalise.py?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/scripting/examples/python/Capitalise.py (original)
+++ incubator/ooo/branches/writer001/main/scripting/examples/python/Capitalise.py Mon Aug 20 11:46:19 2012
@@ -26,16 +26,16 @@ def getNewString( theString ) :
return ""
# should we tokenize on "."?
if theString[0].isupper() and len(theString)>=2 and theString[1].isupper() :
- # first two chars are UC => first UC, rest LC
+ # first two chars are UC => first UC, rest LC
newString=theString[0:1].upper() + theString[1:].lower();
elif theString[0].isupper():
- # first char UC => all to LC
+ # first char UC => all to LC
newString=theString.lower()
else: # all to UC.
newString=theString.upper()
return newString;
-def capitalisePython( ):
+def capitalisePython( ):
"""Change the case of a selection, or current word from upper case, to first char upper case, to all lower case to upper case..."""
import string
@@ -51,7 +51,7 @@ def capitalisePython( ):
count = xIndexAccess.getCount();
if(count>=1): #ie we have a selection
i=0
- while i < count :
+ while i < count :
xTextRange = xIndexAccess.getByIndex(i);
#print "string: " + xTextRange.getString();
theString = xTextRange.getString();
@@ -74,7 +74,7 @@ def capitalisePython( ):
if newString:
xTextRange.setString(newString);
xSelectionSupplier.select(xTextRange);
- i+= 1
+ i+= 1
# lists the scripts, that shall be visible inside OOo. Can be omited, if
Modified: incubator/ooo/branches/writer001/main/scripting/examples/python/pythonSamples/TableSample.py
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/scripting/examples/python/pythonSamples/TableSample.py?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/scripting/examples/python/pythonSamples/TableSample.py (original)
+++ incubator/ooo/branches/writer001/main/scripting/examples/python/pythonSamples/TableSample.py Mon Aug 20 11:46:19 2012
@@ -36,19 +36,19 @@ def insertTextIntoCell( table, cellName,
def createTable():
- """creates a new writer document and inserts a table with some data (also known as the SWriter sample)"""
+ """creates a new writer document and inserts a table with some data (also known as the SWriter sample)"""
ctx = uno.getComponentContext()
smgr = ctx.ServiceManager
desktop = smgr.createInstanceWithContext( "com.sun.star.frame.Desktop",ctx)
-
+
# open a writer document
doc = desktop.loadComponentFromURL( "private:factory/swriter","_blank", 0, () )
-
+
text = doc.Text
cursor = text.createTextCursor()
text.insertString( cursor, "The first line in the newly created text document.\n", 0 )
text.insertString( cursor, "Now we are in the second line\n" , 0 )
-
+
# create a text table
table = doc.createInstance( "com.sun.star.text.TextTable" )
Modified: incubator/ooo/branches/writer001/main/scripting/source/pyprov/mailmerge.py
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/scripting/source/pyprov/mailmerge.py?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/scripting/source/pyprov/mailmerge.py (original)
+++ incubator/ooo/branches/writer001/main/scripting/source/pyprov/mailmerge.py Mon Aug 20 11:46:19 2012
@@ -68,423 +68,423 @@ import sys, smtplib, imaplib, poplib
dbg = False
class PyMailSMTPService(unohelper.Base, XSmtpService):
- def __init__( self, ctx ):
- self.ctx = ctx
- self.listeners = []
- self.supportedtypes = ('Insecure', 'Ssl')
- self.server = None
- self.connectioncontext = None
- self.notify = EventObject(self)
- if dbg:
- print >> sys.stderr, "PyMailSMPTService init"
- def addConnectionListener(self, xListener):
- if dbg:
- print >> sys.stderr, "PyMailSMPTService addConnectionListener"
- self.listeners.append(xListener)
- def removeConnectionListener(self, xListener):
- if dbg:
- print >> sys.stderr, "PyMailSMPTService removeConnectionListener"
- self.listeners.remove(xListener)
- def getSupportedConnectionTypes(self):
- if dbg:
- print >> sys.stderr, "PyMailSMPTService getSupportedConnectionTypes"
- return self.supportedtypes
- def connect(self, xConnectionContext, xAuthenticator):
- self.connectioncontext = xConnectionContext
- if dbg:
- print >> sys.stderr, "PyMailSMPTService connect"
-
- server = xConnectionContext.getValueByName("ServerName")
- if dbg:
- print >> sys.stderr, "ServerName: %s" % server
-
- port = xConnectionContext.getValueByName("Port")
- if dbg:
- print >> sys.stderr, "Port: %d" % port
-
- tout = xConnectionContext.getValueByName("Timeout")
- if dbg:
- print >> sys.stderr, isinstance(tout,int)
- if not isinstance(tout,int):
- tout = _GLOBAL_DEFAULT_TIMEOUT
- if dbg:
- print >> sys.stderr, "Timeout: %s" % str(tout)
-
- self.server = smtplib.SMTP(server, port,timeout=tout)
- if dbg:
- self.server.set_debuglevel(1)
-
- connectiontype = xConnectionContext.getValueByName("ConnectionType")
- if dbg:
- print >> sys.stderr, "ConnectionType: %s" % connectiontype
-
- if connectiontype.upper() == 'SSL':
- self.server.ehlo()
- self.server.starttls()
- self.server.ehlo()
-
- user = xAuthenticator.getUserName().encode('ascii')
- password = xAuthenticator.getPassword().encode('ascii')
- if user != '':
- if dbg:
- print >> sys.stderr, 'Logging in, username of', user
- self.server.login(user, password)
-
- for listener in self.listeners:
- listener.connected(self.notify)
- def disconnect(self):
- if dbg:
- print >> sys.stderr, "PyMailSMPTService disconnect"
- if self.server:
- self.server.quit()
- self.server = None
- for listener in self.listeners:
- listener.disconnected(self.notify)
- def isConnected(self):
- if dbg:
- print >> sys.stderr, "PyMailSMPTService isConnected"
- return self.server != None
- def getCurrentConnectionContext(self):
- if dbg:
- print >> sys.stderr, "PyMailSMPTService getCurrentConnectionContext"
- return self.connectioncontext
- def sendMailMessage(self, xMailMessage):
- COMMASPACE = ', '
-
- if dbg:
- print >> sys.stderr, "PyMailSMPTService sendMailMessage"
- recipients = xMailMessage.getRecipients()
- sendermail = xMailMessage.SenderAddress
- sendername = xMailMessage.SenderName
- subject = xMailMessage.Subject
- ccrecipients = xMailMessage.getCcRecipients()
- bccrecipients = xMailMessage.getBccRecipients()
- if dbg:
- print >> sys.stderr, "PyMailSMPTService subject", subject
- print >> sys.stderr, "PyMailSMPTService from", sendername.encode('utf-8')
- print >> sys.stderr, "PyMailSMTPService from", sendermail
- print >> sys.stderr, "PyMailSMPTService send to", recipients
-
- attachments = xMailMessage.getAttachments()
-
- textmsg = Message()
-
- content = xMailMessage.Body
- flavors = content.getTransferDataFlavors()
- if dbg:
- print >> sys.stderr, "PyMailSMPTService flavors len", len(flavors)
-
- #Use first flavor that's sane for an email body
- for flavor in flavors:
- if flavor.MimeType.find('text/html') != -1 or flavor.MimeType.find('text/plain') != -1:
- if dbg:
- print >> sys.stderr, "PyMailSMPTService mimetype is", flavor.MimeType
- textbody = content.getTransferData(flavor)
- try:
- textbody = textbody.value
- except:
- pass
- textbody = textbody.encode('utf-8')
-
- if len(textbody):
- mimeEncoding = re.sub("charset=.*", "charset=UTF-8", flavor.MimeType)
- if mimeEncoding.find('charset=UTF-8') == -1:
- mimeEncoding = mimeEncoding + "; charset=UTF-8"
- textmsg['Content-Type'] = mimeEncoding
- textmsg['MIME-Version'] = '1.0'
- textmsg.set_payload(textbody)
-
- break
-
- if (len(attachments)):
- msg = MIMEMultipart()
- msg.epilogue = ''
- msg.attach(textmsg)
- else:
- msg = textmsg
-
- hdr = Header(sendername, 'utf-8')
- hdr.append('<'+sendermail+'>','us-ascii')
- msg['Subject'] = subject
- msg['From'] = hdr
- msg['To'] = COMMASPACE.join(recipients)
- if len(ccrecipients):
- msg['Cc'] = COMMASPACE.join(ccrecipients)
- if xMailMessage.ReplyToAddress != '':
- msg['Reply-To'] = xMailMessage.ReplyToAddress
-
- mailerstring = "OpenOffice.org 2.0 via Caolan's mailmerge component"
- try:
- ctx = uno.getComponentContext()
- aConfigProvider = ctx.ServiceManager.createInstance("com.sun.star.configuration.ConfigurationProvider")
- prop = uno.createUnoStruct('com.sun.star.beans.PropertyValue')
- prop.Name = "nodepath"
- prop.Value = "/org.openoffice.Setup/Product"
- aSettings = aConfigProvider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess",
- (prop,))
- mailerstring = aSettings.getByName("ooName") + " " + \
- aSettings.getByName("ooSetupVersion") + " via Caolan's mailmerge component"
- except:
- pass
-
- msg['X-Mailer'] = mailerstring
- msg['Date'] = formatdate(localtime=True)
-
- for attachment in attachments:
- content = attachment.Data
- flavors = content.getTransferDataFlavors()
- flavor = flavors[0]
- ctype = flavor.MimeType
- maintype, subtype = ctype.split('/', 1)
- msgattachment = MIMEBase(maintype, subtype)
- data = content.getTransferData(flavor)
- msgattachment.set_payload(data)
- Encoders.encode_base64(msgattachment)
- fname = attachment.ReadableName
- try:
- fname.encode('ascii')
- except:
- fname = ('utf-8','',fname.encode('utf-8'))
- msgattachment.add_header('Content-Disposition', 'attachment', \
- filename=fname)
- msg.attach(msgattachment)
-
- uniquer = {}
- for key in recipients:
- uniquer[key] = True
- if len(ccrecipients):
- for key in ccrecipients:
- uniquer[key] = True
- if len(bccrecipients):
- for key in bccrecipients:
- uniquer[key] = True
- truerecipients = uniquer.keys()
+ def __init__( self, ctx ):
+ self.ctx = ctx
+ self.listeners = []
+ self.supportedtypes = ('Insecure', 'Ssl')
+ self.server = None
+ self.connectioncontext = None
+ self.notify = EventObject(self)
+ if dbg:
+ print >> sys.stderr, "PyMailSMPTService init"
+ def addConnectionListener(self, xListener):
+ if dbg:
+ print >> sys.stderr, "PyMailSMPTService addConnectionListener"
+ self.listeners.append(xListener)
+ def removeConnectionListener(self, xListener):
+ if dbg:
+ print >> sys.stderr, "PyMailSMPTService removeConnectionListener"
+ self.listeners.remove(xListener)
+ def getSupportedConnectionTypes(self):
+ if dbg:
+ print >> sys.stderr, "PyMailSMPTService getSupportedConnectionTypes"
+ return self.supportedtypes
+ def connect(self, xConnectionContext, xAuthenticator):
+ self.connectioncontext = xConnectionContext
+ if dbg:
+ print >> sys.stderr, "PyMailSMPTService connect"
+
+ server = xConnectionContext.getValueByName("ServerName")
+ if dbg:
+ print >> sys.stderr, "ServerName: %s" % server
+
+ port = xConnectionContext.getValueByName("Port")
+ if dbg:
+ print >> sys.stderr, "Port: %d" % port
+
+ tout = xConnectionContext.getValueByName("Timeout")
+ if dbg:
+ print >> sys.stderr, isinstance(tout,int)
+ if not isinstance(tout,int):
+ tout = _GLOBAL_DEFAULT_TIMEOUT
+ if dbg:
+ print >> sys.stderr, "Timeout: %s" % str(tout)
+
+ self.server = smtplib.SMTP(server, port,timeout=tout)
+ if dbg:
+ self.server.set_debuglevel(1)
+
+ connectiontype = xConnectionContext.getValueByName("ConnectionType")
+ if dbg:
+ print >> sys.stderr, "ConnectionType: %s" % connectiontype
+
+ if connectiontype.upper() == 'SSL':
+ self.server.ehlo()
+ self.server.starttls()
+ self.server.ehlo()
+
+ user = xAuthenticator.getUserName().encode('ascii')
+ password = xAuthenticator.getPassword().encode('ascii')
+ if user != '':
+ if dbg:
+ print >> sys.stderr, 'Logging in, username of', user
+ self.server.login(user, password)
+
+ for listener in self.listeners:
+ listener.connected(self.notify)
+ def disconnect(self):
+ if dbg:
+ print >> sys.stderr, "PyMailSMPTService disconnect"
+ if self.server:
+ self.server.quit()
+ self.server = None
+ for listener in self.listeners:
+ listener.disconnected(self.notify)
+ def isConnected(self):
+ if dbg:
+ print >> sys.stderr, "PyMailSMPTService isConnected"
+ return self.server != None
+ def getCurrentConnectionContext(self):
+ if dbg:
+ print >> sys.stderr, "PyMailSMPTService getCurrentConnectionContext"
+ return self.connectioncontext
+ def sendMailMessage(self, xMailMessage):
+ COMMASPACE = ', '
+
+ if dbg:
+ print >> sys.stderr, "PyMailSMPTService sendMailMessage"
+ recipients = xMailMessage.getRecipients()
+ sendermail = xMailMessage.SenderAddress
+ sendername = xMailMessage.SenderName
+ subject = xMailMessage.Subject
+ ccrecipients = xMailMessage.getCcRecipients()
+ bccrecipients = xMailMessage.getBccRecipients()
+ if dbg:
+ print >> sys.stderr, "PyMailSMPTService subject", subject
+ print >> sys.stderr, "PyMailSMPTService from", sendername.encode('utf-8')
+ print >> sys.stderr, "PyMailSMTPService from", sendermail
+ print >> sys.stderr, "PyMailSMPTService send to", recipients
+
+ attachments = xMailMessage.getAttachments()
+
+ textmsg = Message()
+
+ content = xMailMessage.Body
+ flavors = content.getTransferDataFlavors()
+ if dbg:
+ print >> sys.stderr, "PyMailSMPTService flavors len", len(flavors)
+
+ #Use first flavor that's sane for an email body
+ for flavor in flavors:
+ if flavor.MimeType.find('text/html') != -1 or flavor.MimeType.find('text/plain') != -1:
+ if dbg:
+ print >> sys.stderr, "PyMailSMPTService mimetype is", flavor.MimeType
+ textbody = content.getTransferData(flavor)
+ try:
+ textbody = textbody.value
+ except:
+ pass
+ textbody = textbody.encode('utf-8')
+
+ if len(textbody):
+ mimeEncoding = re.sub("charset=.*", "charset=UTF-8", flavor.MimeType)
+ if mimeEncoding.find('charset=UTF-8') == -1:
+ mimeEncoding = mimeEncoding + "; charset=UTF-8"
+ textmsg['Content-Type'] = mimeEncoding
+ textmsg['MIME-Version'] = '1.0'
+ textmsg.set_payload(textbody)
+
+ break
+
+ if (len(attachments)):
+ msg = MIMEMultipart()
+ msg.epilogue = ''
+ msg.attach(textmsg)
+ else:
+ msg = textmsg
+
+ hdr = Header(sendername, 'utf-8')
+ hdr.append('<'+sendermail+'>','us-ascii')
+ msg['Subject'] = subject
+ msg['From'] = hdr
+ msg['To'] = COMMASPACE.join(recipients)
+ if len(ccrecipients):
+ msg['Cc'] = COMMASPACE.join(ccrecipients)
+ if xMailMessage.ReplyToAddress != '':
+ msg['Reply-To'] = xMailMessage.ReplyToAddress
+
+ mailerstring = "OpenOffice.org 2.0 via Caolan's mailmerge component"
+ try:
+ ctx = uno.getComponentContext()
+ aConfigProvider = ctx.ServiceManager.createInstance("com.sun.star.configuration.ConfigurationProvider")
+ prop = uno.createUnoStruct('com.sun.star.beans.PropertyValue')
+ prop.Name = "nodepath"
+ prop.Value = "/org.openoffice.Setup/Product"
+ aSettings = aConfigProvider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess",
+ (prop,))
+ mailerstring = aSettings.getByName("ooName") + " " + \
+ aSettings.getByName("ooSetupVersion") + " via Caolan's mailmerge component"
+ except:
+ pass
+
+ msg['X-Mailer'] = mailerstring
+ msg['Date'] = formatdate(localtime=True)
+
+ for attachment in attachments:
+ content = attachment.Data
+ flavors = content.getTransferDataFlavors()
+ flavor = flavors[0]
+ ctype = flavor.MimeType
+ maintype, subtype = ctype.split('/', 1)
+ msgattachment = MIMEBase(maintype, subtype)
+ data = content.getTransferData(flavor)
+ msgattachment.set_payload(data)
+ Encoders.encode_base64(msgattachment)
+ fname = attachment.ReadableName
+ try:
+ fname.encode('ascii')
+ except:
+ fname = ('utf-8','',fname.encode('utf-8'))
+ msgattachment.add_header('Content-Disposition', 'attachment', \
+ filename=fname)
+ msg.attach(msgattachment)
+
+ uniquer = {}
+ for key in recipients:
+ uniquer[key] = True
+ if len(ccrecipients):
+ for key in ccrecipients:
+ uniquer[key] = True
+ if len(bccrecipients):
+ for key in bccrecipients:
+ uniquer[key] = True
+ truerecipients = uniquer.keys()
- if dbg:
- print >> sys.stderr, "PyMailSMPTService recipients are", truerecipients
+ if dbg:
+ print >> sys.stderr, "PyMailSMPTService recipients are", truerecipients
- self.server.sendmail(sendermail, truerecipients, msg.as_string())
+ self.server.sendmail(sendermail, truerecipients, msg.as_string())
class PyMailIMAPService(unohelper.Base, XMailService):
- def __init__( self, ctx ):
- self.ctx = ctx
- self.listeners = []
- self.supportedtypes = ('Insecure', 'Ssl')
- self.server = None
- self.connectioncontext = None
- self.notify = EventObject(self)
- if dbg:
- print >> sys.stderr, "PyMailIMAPService init"
- def addConnectionListener(self, xListener):
- if dbg:
- print >> sys.stderr, "PyMailIMAPService addConnectionListener"
- self.listeners.append(xListener)
- def removeConnectionListener(self, xListener):
- if dbg:
- print >> sys.stderr, "PyMailIMAPService removeConnectionListener"
- self.listeners.remove(xListener)
- def getSupportedConnectionTypes(self):
- if dbg:
- print >> sys.stderr, "PyMailIMAPService getSupportedConnectionTypes"
- return self.supportedtypes
- def connect(self, xConnectionContext, xAuthenticator):
- if dbg:
- print >> sys.stderr, "PyMailIMAPService connect"
-
- self.connectioncontext = xConnectionContext
- server = xConnectionContext.getValueByName("ServerName")
- if dbg:
- print >> sys.stderr, server
- port = xConnectionContext.getValueByName("Port")
- if dbg:
- print >> sys.stderr, port
- connectiontype = xConnectionContext.getValueByName("ConnectionType")
- if dbg:
- print >> sys.stderr, connectiontype
- print >> sys.stderr, "BEFORE"
- if connectiontype.upper() == 'SSL':
- self.server = imaplib.IMAP4_SSL(server, port)
- else:
- self.server = imaplib.IMAP4(server, port)
- print >> sys.stderr, "AFTER"
-
- user = xAuthenticator.getUserName().encode('ascii')
- password = xAuthenticator.getPassword().encode('ascii')
- if user != '':
- if dbg:
- print >> sys.stderr, 'Logging in, username of', user
- self.server.login(user, password)
-
- for listener in self.listeners:
- listener.connected(self.notify)
- def disconnect(self):
- if dbg:
- print >> sys.stderr, "PyMailIMAPService disconnect"
- if self.server:
- self.server.logout()
- self.server = None
- for listener in self.listeners:
- listener.disconnected(self.notify)
- def isConnected(self):
- if dbg:
- print >> sys.stderr, "PyMailIMAPService isConnected"
- return self.server != None
- def getCurrentConnectionContext(self):
- if dbg:
- print >> sys.stderr, "PyMailIMAPService getCurrentConnectionContext"
- return self.connectioncontext
+ def __init__( self, ctx ):
+ self.ctx = ctx
+ self.listeners = []
+ self.supportedtypes = ('Insecure', 'Ssl')
+ self.server = None
+ self.connectioncontext = None
+ self.notify = EventObject(self)
+ if dbg:
+ print >> sys.stderr, "PyMailIMAPService init"
+ def addConnectionListener(self, xListener):
+ if dbg:
+ print >> sys.stderr, "PyMailIMAPService addConnectionListener"
+ self.listeners.append(xListener)
+ def removeConnectionListener(self, xListener):
+ if dbg:
+ print >> sys.stderr, "PyMailIMAPService removeConnectionListener"
+ self.listeners.remove(xListener)
+ def getSupportedConnectionTypes(self):
+ if dbg:
+ print >> sys.stderr, "PyMailIMAPService getSupportedConnectionTypes"
+ return self.supportedtypes
+ def connect(self, xConnectionContext, xAuthenticator):
+ if dbg:
+ print >> sys.stderr, "PyMailIMAPService connect"
+
+ self.connectioncontext = xConnectionContext
+ server = xConnectionContext.getValueByName("ServerName")
+ if dbg:
+ print >> sys.stderr, server
+ port = xConnectionContext.getValueByName("Port")
+ if dbg:
+ print >> sys.stderr, port
+ connectiontype = xConnectionContext.getValueByName("ConnectionType")
+ if dbg:
+ print >> sys.stderr, connectiontype
+ print >> sys.stderr, "BEFORE"
+ if connectiontype.upper() == 'SSL':
+ self.server = imaplib.IMAP4_SSL(server, port)
+ else:
+ self.server = imaplib.IMAP4(server, port)
+ print >> sys.stderr, "AFTER"
+
+ user = xAuthenticator.getUserName().encode('ascii')
+ password = xAuthenticator.getPassword().encode('ascii')
+ if user != '':
+ if dbg:
+ print >> sys.stderr, 'Logging in, username of', user
+ self.server.login(user, password)
+
+ for listener in self.listeners:
+ listener.connected(self.notify)
+ def disconnect(self):
+ if dbg:
+ print >> sys.stderr, "PyMailIMAPService disconnect"
+ if self.server:
+ self.server.logout()
+ self.server = None
+ for listener in self.listeners:
+ listener.disconnected(self.notify)
+ def isConnected(self):
+ if dbg:
+ print >> sys.stderr, "PyMailIMAPService isConnected"
+ return self.server != None
+ def getCurrentConnectionContext(self):
+ if dbg:
+ print >> sys.stderr, "PyMailIMAPService getCurrentConnectionContext"
+ return self.connectioncontext
class PyMailPOP3Service(unohelper.Base, XMailService):
- def __init__( self, ctx ):
- self.ctx = ctx
- self.listeners = []
- self.supportedtypes = ('Insecure', 'Ssl')
- self.server = None
- self.connectioncontext = None
- self.notify = EventObject(self)
- if dbg:
- print >> sys.stderr, "PyMailPOP3Service init"
- def addConnectionListener(self, xListener):
- if dbg:
- print >> sys.stderr, "PyMailPOP3Service addConnectionListener"
- self.listeners.append(xListener)
- def removeConnectionListener(self, xListener):
- if dbg:
- print >> sys.stderr, "PyMailPOP3Service removeConnectionListener"
- self.listeners.remove(xListener)
- def getSupportedConnectionTypes(self):
- if dbg:
- print >> sys.stderr, "PyMailPOP3Service getSupportedConnectionTypes"
- return self.supportedtypes
- def connect(self, xConnectionContext, xAuthenticator):
- if dbg:
- print >> sys.stderr, "PyMailPOP3Service connect"
-
- self.connectioncontext = xConnectionContext
- server = xConnectionContext.getValueByName("ServerName")
- if dbg:
- print >> sys.stderr, server
- port = xConnectionContext.getValueByName("Port")
- if dbg:
- print >> sys.stderr, port
- connectiontype = xConnectionContext.getValueByName("ConnectionType")
- if dbg:
- print >> sys.stderr, connectiontype
- print >> sys.stderr, "BEFORE"
- if connectiontype.upper() == 'SSL':
- self.server = poplib.POP3_SSL(server, port)
- else:
- tout = xConnectionContext.getValueByName("Timeout")
- if dbg:
- print >> sys.stderr, isinstance(tout,int)
- if not isinstance(tout,int):
- tout = _GLOBAL_DEFAULT_TIMEOUT
- if dbg:
- print >> sys.stderr, "Timeout: %s" % str(tout)
- self.server = poplib.POP3(server, port, timeout=tout)
- print >> sys.stderr, "AFTER"
-
- user = xAuthenticator.getUserName().encode('ascii')
- password = xAuthenticator.getPassword().encode('ascii')
- if dbg:
- print >> sys.stderr, 'Logging in, username of', user
- self.server.user(user)
- self.server.pass_(password)
-
- for listener in self.listeners:
- listener.connected(self.notify)
- def disconnect(self):
- if dbg:
- print >> sys.stderr, "PyMailPOP3Service disconnect"
- if self.server:
- self.server.quit()
- self.server = None
- for listener in self.listeners:
- listener.disconnected(self.notify)
- def isConnected(self):
- if dbg:
- print >> sys.stderr, "PyMailPOP3Service isConnected"
- return self.server != None
- def getCurrentConnectionContext(self):
- if dbg:
- print >> sys.stderr, "PyMailPOP3Service getCurrentConnectionContext"
- return self.connectioncontext
+ def __init__( self, ctx ):
+ self.ctx = ctx
+ self.listeners = []
+ self.supportedtypes = ('Insecure', 'Ssl')
+ self.server = None
+ self.connectioncontext = None
+ self.notify = EventObject(self)
+ if dbg:
+ print >> sys.stderr, "PyMailPOP3Service init"
+ def addConnectionListener(self, xListener):
+ if dbg:
+ print >> sys.stderr, "PyMailPOP3Service addConnectionListener"
+ self.listeners.append(xListener)
+ def removeConnectionListener(self, xListener):
+ if dbg:
+ print >> sys.stderr, "PyMailPOP3Service removeConnectionListener"
+ self.listeners.remove(xListener)
+ def getSupportedConnectionTypes(self):
+ if dbg:
+ print >> sys.stderr, "PyMailPOP3Service getSupportedConnectionTypes"
+ return self.supportedtypes
+ def connect(self, xConnectionContext, xAuthenticator):
+ if dbg:
+ print >> sys.stderr, "PyMailPOP3Service connect"
+
+ self.connectioncontext = xConnectionContext
+ server = xConnectionContext.getValueByName("ServerName")
+ if dbg:
+ print >> sys.stderr, server
+ port = xConnectionContext.getValueByName("Port")
+ if dbg:
+ print >> sys.stderr, port
+ connectiontype = xConnectionContext.getValueByName("ConnectionType")
+ if dbg:
+ print >> sys.stderr, connectiontype
+ print >> sys.stderr, "BEFORE"
+ if connectiontype.upper() == 'SSL':
+ self.server = poplib.POP3_SSL(server, port)
+ else:
+ tout = xConnectionContext.getValueByName("Timeout")
+ if dbg:
+ print >> sys.stderr, isinstance(tout,int)
+ if not isinstance(tout,int):
+ tout = _GLOBAL_DEFAULT_TIMEOUT
+ if dbg:
+ print >> sys.stderr, "Timeout: %s" % str(tout)
+ self.server = poplib.POP3(server, port, timeout=tout)
+ print >> sys.stderr, "AFTER"
+
+ user = xAuthenticator.getUserName().encode('ascii')
+ password = xAuthenticator.getPassword().encode('ascii')
+ if dbg:
+ print >> sys.stderr, 'Logging in, username of', user
+ self.server.user(user)
+ self.server.pass_(password)
+
+ for listener in self.listeners:
+ listener.connected(self.notify)
+ def disconnect(self):
+ if dbg:
+ print >> sys.stderr, "PyMailPOP3Service disconnect"
+ if self.server:
+ self.server.quit()
+ self.server = None
+ for listener in self.listeners:
+ listener.disconnected(self.notify)
+ def isConnected(self):
+ if dbg:
+ print >> sys.stderr, "PyMailPOP3Service isConnected"
+ return self.server != None
+ def getCurrentConnectionContext(self):
+ if dbg:
+ print >> sys.stderr, "PyMailPOP3Service getCurrentConnectionContext"
+ return self.connectioncontext
class PyMailServiceProvider(unohelper.Base, XMailServiceProvider):
- def __init__( self, ctx ):
- if dbg:
- print >> sys.stderr, "PyMailServiceProvider init"
- self.ctx = ctx
- def create(self, aType):
- if dbg:
- print >> sys.stderr, "PyMailServiceProvider create with", aType
- if aType == SMTP:
- return PyMailSMTPService(self.ctx);
- elif aType == POP3:
- return PyMailPOP3Service(self.ctx);
- elif aType == IMAP:
- return PyMailIMAPService(self.ctx);
- else:
- print >> sys.stderr, "PyMailServiceProvider, unknown TYPE", aType
+ def __init__( self, ctx ):
+ if dbg:
+ print >> sys.stderr, "PyMailServiceProvider init"
+ self.ctx = ctx
+ def create(self, aType):
+ if dbg:
+ print >> sys.stderr, "PyMailServiceProvider create with", aType
+ if aType == SMTP:
+ return PyMailSMTPService(self.ctx);
+ elif aType == POP3:
+ return PyMailPOP3Service(self.ctx);
+ elif aType == IMAP:
+ return PyMailIMAPService(self.ctx);
+ else:
+ print >> sys.stderr, "PyMailServiceProvider, unknown TYPE", aType
class PyMailMessage(unohelper.Base, XMailMessage):
- def __init__( self, ctx, sTo='', sFrom='', Subject='', Body=None, aMailAttachment=None ):
- if dbg:
- print >> sys.stderr, "PyMailMessage init"
- self.ctx = ctx
-
- self.recipients = [sTo]
- self.ccrecipients = []
- self.bccrecipients = []
- self.aMailAttachments = []
- if aMailAttachment != None:
- self.aMailAttachments.append(aMailAttachment)
-
- self.SenderName, self.SenderAddress = parseaddr(sFrom)
- self.ReplyToAddress = sFrom
- self.Subject = Subject
- self.Body = Body
- if dbg:
- print >> sys.stderr, "post PyMailMessage init"
- def addRecipient( self, recipient ):
- if dbg:
- print >> sys.stderr, "PyMailMessage.addRecipient", recipient
- self.recipients.append(recipient)
- def addCcRecipient( self, ccrecipient ):
- if dbg:
- print >> sys.stderr, "PyMailMessage.addCcRecipient", ccrecipient
- self.ccrecipients.append(ccrecipient)
- def addBccRecipient( self, bccrecipient ):
- if dbg:
- print >> sys.stderr, "PyMailMessage.addBccRecipient", bccrecipient
- self.bccrecipients.append(bccrecipient)
- def getRecipients( self ):
- if dbg:
- print >> sys.stderr, "PyMailMessage.getRecipients", self.recipients
- return tuple(self.recipients)
- def getCcRecipients( self ):
- if dbg:
- print >> sys.stderr, "PyMailMessage.getCcRecipients", self.ccrecipients
- return tuple(self.ccrecipients)
- def getBccRecipients( self ):
- if dbg:
- print >> sys.stderr, "PyMailMessage.getBccRecipients", self.bccrecipients
- return tuple(self.bccrecipients)
- def addAttachment( self, aMailAttachment ):
- if dbg:
- print >> sys.stderr, "PyMailMessage.addAttachment"
- self.aMailAttachments.append(aMailAttachment)
- def getAttachments( self ):
- if dbg:
- print >> sys.stderr, "PyMailMessage.getAttachments"
- return tuple(self.aMailAttachments)
+ def __init__( self, ctx, sTo='', sFrom='', Subject='', Body=None, aMailAttachment=None ):
+ if dbg:
+ print >> sys.stderr, "PyMailMessage init"
+ self.ctx = ctx
+
+ self.recipients = [sTo]
+ self.ccrecipients = []
+ self.bccrecipients = []
+ self.aMailAttachments = []
+ if aMailAttachment != None:
+ self.aMailAttachments.append(aMailAttachment)
+
+ self.SenderName, self.SenderAddress = parseaddr(sFrom)
+ self.ReplyToAddress = sFrom
+ self.Subject = Subject
+ self.Body = Body
+ if dbg:
+ print >> sys.stderr, "post PyMailMessage init"
+ def addRecipient( self, recipient ):
+ if dbg:
+ print >> sys.stderr, "PyMailMessage.addRecipient", recipient
+ self.recipients.append(recipient)
+ def addCcRecipient( self, ccrecipient ):
+ if dbg:
+ print >> sys.stderr, "PyMailMessage.addCcRecipient", ccrecipient
+ self.ccrecipients.append(ccrecipient)
+ def addBccRecipient( self, bccrecipient ):
+ if dbg:
+ print >> sys.stderr, "PyMailMessage.addBccRecipient", bccrecipient
+ self.bccrecipients.append(bccrecipient)
+ def getRecipients( self ):
+ if dbg:
+ print >> sys.stderr, "PyMailMessage.getRecipients", self.recipients
+ return tuple(self.recipients)
+ def getCcRecipients( self ):
+ if dbg:
+ print >> sys.stderr, "PyMailMessage.getCcRecipients", self.ccrecipients
+ return tuple(self.ccrecipients)
+ def getBccRecipients( self ):
+ if dbg:
+ print >> sys.stderr, "PyMailMessage.getBccRecipients", self.bccrecipients
+ return tuple(self.bccrecipients)
+ def addAttachment( self, aMailAttachment ):
+ if dbg:
+ print >> sys.stderr, "PyMailMessage.addAttachment"
+ self.aMailAttachments.append(aMailAttachment)
+ def getAttachments( self ):
+ if dbg:
+ print >> sys.stderr, "PyMailMessage.getAttachments"
+ return tuple(self.aMailAttachments)
# pythonloader looks for a static g_ImplementationHelper variable
g_ImplementationHelper = unohelper.ImplementationHelper()
g_ImplementationHelper.addImplementation( \
- PyMailServiceProvider, "org.openoffice.pyuno.MailServiceProvider",
- ("com.sun.star.mail.MailServiceProvider",),)
+ PyMailServiceProvider, "org.openoffice.pyuno.MailServiceProvider",
+ ("com.sun.star.mail.MailServiceProvider",),)
g_ImplementationHelper.addImplementation( \
- PyMailMessage, "org.openoffice.pyuno.MailMessage",
- ("com.sun.star.mail.MailMessage",),)
+ PyMailMessage, "org.openoffice.pyuno.MailMessage",
+ ("com.sun.star.mail.MailMessage",),)
Modified: incubator/ooo/branches/writer001/main/scripting/source/pyprov/officehelper.py
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/scripting/source/pyprov/officehelper.py?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/scripting/source/pyprov/officehelper.py (original)
+++ incubator/ooo/branches/writer001/main/scripting/source/pyprov/officehelper.py Mon Aug 20 11:46:19 2012
@@ -39,32 +39,32 @@ class BootstrapException(UnoException):
def bootstrap():
"""Bootstrap OOo and PyUNO Runtime.
The soffice process is started opening a named pipe of random name, then the local context is used
- to access the pipe. This function directly returns the remote component context, from whereon you can
- get the ServiceManager by calling getServiceManager() on the returned object.
- """
+ to access the pipe. This function directly returns the remote component context, from whereon you can
+ get the ServiceManager by calling getServiceManager() on the returned object.
+ """
try:
- # soffice script used on *ix, Mac; soffice.exe used on Windoof
+ # soffice script used on *ix, Mac; soffice.exe used on Windoof
if "UNO_PATH" in os.environ:
sOffice = os.environ["UNO_PATH"]
else:
sOffice = "" # lets hope for the best
sOffice = os.path.join(sOffice, "soffice")
- if platform.startswith("win"):
+ if platform.startswith("win"):
sOffice += ".exe"
-
+
# Generate a random pipe name.
random.seed()
sPipeName = "uno" + str(random.random())[2:]
-
+
# Start the office proces, don't check for exit status since an exception is caught anyway if the office terminates unexpectedly.
- cmdArray = (sOffice, "-nologo", "-nodefault", "".join(["-accept=pipe,name=", sPipeName, ";urp;"]))
+ cmdArray = (sOffice, "-nologo", "-nodefault", "".join(["-accept=pipe,name=", sPipeName, ";urp;"]))
os.spawnv(os.P_NOWAIT, sOffice, cmdArray)
-
+
# ---------
xLocalContext = uno.getComponentContext()
resolver = xLocalContext.ServiceManager.createInstanceWithContext(
- "com.sun.star.bridge.UnoUrlResolver", xLocalContext)
+ "com.sun.star.bridge.UnoUrlResolver", xLocalContext)
sConnect = "".join(["uno:pipe,name=", sPipeName, ";urp;StarOffice.ComponentContext"])
# Wait until an office is started, but loop only nLoop times (can we do this better???)
@@ -80,7 +80,7 @@ def bootstrap():
sleep(0.5) # Sleep 1/2 second.
except BootstrapException:
- raise
+ raise
except Exception, e: # Any other exception
raise BootstrapException("Caught exception " + str(e), None)